mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added dataservice for adding and removing msgs and grps from. does not compile.
just a check point Added client side defintions of msg and grp git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5175 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a957ec75b6
commit
f05ed342ed
154
libretroshare/src/gxs/rsdataservice.cpp
Normal file
154
libretroshare/src/gxs/rsdataservice.cpp
Normal file
@ -0,0 +1,154 @@
|
||||
#include "rsdataservice.h"
|
||||
|
||||
#define MSG_TABLE_NAME std::string("MESSAGES")
|
||||
#define GRP_TABLE_NAME std::string("GROUPS")
|
||||
|
||||
|
||||
// generic
|
||||
#define NXS_FILE std::string("msgFile")
|
||||
#define NXS_FILE_OFFSET std::string("fileOffset")
|
||||
#define NXS_LEN std::string("msgLen")
|
||||
#define NXS_IDENTITY std::string("identity")
|
||||
#define GRP_ID std::string("grpId")
|
||||
#define IDENTITY_SIGN std::string("idSign")
|
||||
#define TIME_STAMP std::string("timeStamp")
|
||||
#define NXS_FLAGS std::string("flags")
|
||||
|
||||
// grp table columns
|
||||
#define ADMIN_SIGN std::string("adminSign")
|
||||
#define PUB_PUBLISH_KEY std::string("pubPublishhKey")
|
||||
#define PUB_ADMIN_KEY std::string("pubAdminKey")
|
||||
#define PRIV_ADMIN_KEY std::string("privAdminKey")
|
||||
#define PRIV_PUBLISH_KEY std::string("privPublishKey")
|
||||
#define GRP_FILE std::string("grpFile")
|
||||
|
||||
|
||||
// msg table columns
|
||||
#define PUBLISH_SIGN std::string("publishSign")
|
||||
#define MSG_ID std::string("msgId")
|
||||
|
||||
|
||||
// grp col numbers
|
||||
#define COL_GRP_ID 1
|
||||
#define COL_ADMIN_SIGN 2
|
||||
#define COL_PUB_PUBLISH_KEY 10
|
||||
#define COL_PUB_ADMIN_KEY 11
|
||||
#define COL_PRIV_ADMIN_KEY 12
|
||||
#define COL_PRIV_PUBLISH_KEY 13
|
||||
|
||||
|
||||
// msg col numbers
|
||||
#define COL_MSG_ID 1
|
||||
#define COL_PUBLISH_SIGN 2
|
||||
|
||||
// generic col numbers
|
||||
#define COL_NXS_FILE 3
|
||||
#define COL_NXS_FILE_OFFSET 4
|
||||
#define COL_NXS_LEN 5
|
||||
#define COL_TIME_STAMP 6
|
||||
#define COL_FLAGS 7
|
||||
#define COL_IDENTITY_SIGN 8
|
||||
#define COL_IDENTITY 9
|
||||
|
||||
|
||||
RsDataService::RsDataService(const std::string &workingDir, const std::string &dbNamem, uint16_t serviceType)
|
||||
{
|
||||
|
||||
|
||||
// initialise database
|
||||
remove("RsFileGdp_DataBase");
|
||||
mDb = new RetroDb(dbName, RetroDb::OPEN_READWRITE_CREATE);
|
||||
|
||||
// create table for msgs
|
||||
mDb->execSQL("CREATE TABLE " + MSG_TABLE_NAME + "(" + MSG_ID
|
||||
+ " TEXT PRIMARY KEY ASC," + GRP_ID + " TEXT," + FLAGS + " INT,"
|
||||
+ TIME_STAMP + " INT," + PUBLISH_SIGN + " BLOB," + NXS_IDENTITY + " TEXT,"
|
||||
+ IDENTITY_SIGN + " BLOB," + NXS_FILE + " TEXT,"+ NXS_FILE_OFFSET + " INT,"
|
||||
+ NXS_LEN+ " INT);");
|
||||
|
||||
// create table for grps
|
||||
mDb->execSQL("CREATE TABLE " + GRP_TABLE_NAME + "(" + GRP_ID +
|
||||
" TEXT PRIMARY KEY ASC," + TIME_STAMP + " INT," +
|
||||
ADMIN_SIGN + " BLOB," + PUB_ADMIN_KEY + " BLOB,"
|
||||
+ PUB_PUBLISH_KEY + " BLOB," + PRIV_ADMIN_KEY +
|
||||
" BLOB," + PRIV_PUBLISH_KEY + " BLOB," + NXS_FILE +
|
||||
" TEXT," + NXS_FILE_OFFSET + " INT," + NXS_LEN + " INT,"
|
||||
+ NXS_IDENTITY + " TEXT," + IDENTITY_SIGN + " BLOB);");
|
||||
|
||||
|
||||
msgColumns.push_back(MSG_ID); msgColumns.push_back(PUBLISH_SIGN); msgColumns.push_back(NXS_FILE);
|
||||
msgColumns.push_back(NXS_FILE_OFFSET); msgColumns.push_back(NXS_LEN); msgColumns.push_back(TIME_STAMP);
|
||||
msgColumns.push_back(NXS_FLAGS); msgColumns.push_back(IDENTITY); msgColumns.push_back(IDENTITY_SIGN);
|
||||
|
||||
grpColumns.push_back(GRP_ID); grpColumns.push_back(ADMIN_SIGN); grpColumns.push_back(NXS_FILE);
|
||||
grpColumns.push_back(NXS_FILE_OFFSET); grpColumns.push_back(NXS_LEN); grpColumns.push_back(TIME_STAMP);
|
||||
grpColumns.push_back(NXS_FLAGS); grpColumns.push_back(IDENTITY); grpColumns.push_back(IDENTITY_SIGN);
|
||||
grpColumns.push_back(PUB_PUBLISH_KEY); grpColumns.push_back(PUB_ADMIN_KEY); grpColumns.push_back(PRIV_ADMIN_KEY);
|
||||
grpColumns.push_back(PRIV_PUBLISH_KEY); grpColumns.push_back(GRP_FILE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RsNxsGrp* RsDataService::getGroup(RetroCursor &c){
|
||||
|
||||
RsNxsGrp* grp = new RsNxsGrp(mServType);
|
||||
bool ok = true;
|
||||
|
||||
std::ifstream istrm;
|
||||
uint32_t len, offset;
|
||||
char* data = NULL;
|
||||
uint32_t data_len = 0;
|
||||
uint32_t offset = 0;
|
||||
std::string grpId;
|
||||
uint32_t timeStamp;
|
||||
RsTlvBinaryData grpData;
|
||||
RsTlvSecurityKey adminKey, pubKey, privAdminKey, privPubKey;
|
||||
std::string identity;
|
||||
|
||||
|
||||
c.getString(COL_GRP_ID, grpId);
|
||||
ok &= !grpId.empty();
|
||||
c.getString(COL_IDENTITY, identity);
|
||||
|
||||
timeStamp = c.getInt64(COL_TIME_STAMP);
|
||||
|
||||
/* get keys */
|
||||
grp->keys.groupId = grpId;
|
||||
|
||||
data = c.getData(COL_PUB_ADMIN_KEY, data_len);
|
||||
ok &= data;
|
||||
if(data){
|
||||
adminKey.GetTlv(data, data_len, &offset);
|
||||
grp->keys.keys.insert(adminKey);
|
||||
}
|
||||
offset = 0;
|
||||
|
||||
data = c.getData(COL_PUB_PUBLISH_KEY, data_len);
|
||||
ok &= data;
|
||||
if(data){
|
||||
pubKey.GetTlv(data, data_len, &offset);
|
||||
grp->keys.keys.insert(pubKey);
|
||||
}
|
||||
offset = 0;
|
||||
|
||||
data = c.getData(COL_PRIV_ADMIN_KEY, data_len);
|
||||
if(data){
|
||||
privAdminKey.GetTlv(COL_PRIV_ADMIN_KEY, data_len, &offset);
|
||||
grp->keys.keys.insert(privAdminKey);
|
||||
}
|
||||
offset = 0;
|
||||
|
||||
data = c.getData(COL_PRIV_PUBLISH_KEY);
|
||||
if(data){
|
||||
privPubKey.GetTlv(data, data_len, &offset);
|
||||
grp->keys.keys.insert(privPubKey);
|
||||
}
|
||||
|
||||
if(ok)
|
||||
return grp;
|
||||
else
|
||||
delete grp;
|
||||
|
||||
return NULL;
|
||||
}
|
99
libretroshare/src/gxs/rsdataservice.h
Normal file
99
libretroshare/src/gxs/rsdataservice.h
Normal file
@ -0,0 +1,99 @@
|
||||
#ifndef RSDATASERVICE_H
|
||||
#define RSDATASERVICE_H
|
||||
|
||||
#include "rsgds.h"
|
||||
|
||||
#include "util/retrodb.h"
|
||||
|
||||
class RsDataService : public RsGeneralDataService
|
||||
{
|
||||
public:
|
||||
|
||||
RsDataService(const std::string& workingDir, const std::string& dbName, uint16_t serviceType);
|
||||
virtual ~RsDataService();
|
||||
|
||||
/*!
|
||||
* Retrieves signed message
|
||||
* @param msgIds ids of messagesto retrieve
|
||||
* @param msg result of msg retrieval
|
||||
* @param cache whether to store retrieval in memory for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveMsgs(const std::list<std::string>& msgIds, std::set<RsGxsMsg*> msg, bool cache);
|
||||
|
||||
/*!
|
||||
* Retrieves a group item by grpId
|
||||
* @param grpId the Id of the groups to retrieve
|
||||
* @param grp results of retrieval
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveGrps(const std::list<std::string>& grpId, std::set<RsGxsGroup*>& grp, bool cache);
|
||||
|
||||
/*!
|
||||
* @param grpId the id of the group to get versions for
|
||||
* @param cache whether to store the result in memory
|
||||
* @param errCode
|
||||
*/
|
||||
int retrieveGrpVersions(const std::string& grpId, std::set<RsGxsGroup*>& grp, bool cache);
|
||||
|
||||
/*!
|
||||
* @param msgId the id of the message to get versions for
|
||||
* @param cache whether to store the result in memory
|
||||
* @param errCode
|
||||
*/
|
||||
int retrieveMsgVersions(const std::string& grpId, std::set<RsGxsGroup*> grp, bool cache);
|
||||
|
||||
|
||||
/*!
|
||||
* allows for more complex queries specific to the service
|
||||
* @param search generally stores parameters needed for query
|
||||
* @param msgId is set with msg ids which satisfy the gxs search
|
||||
* @return error code
|
||||
*/
|
||||
int searchMsgs(RsGxsSearch* search, std::list<RsGxsSrchResMsgCtx*>& result);
|
||||
|
||||
/*!
|
||||
* allows for more complex queries specific to the associated service
|
||||
* @param search generally stores parameters needed for query
|
||||
* @param msgId is set with msg ids which satisfy the gxs search
|
||||
* @return error code
|
||||
*/
|
||||
int searchGrps(RsGxsSearch* search, std::list<RsGxsSrchResGrpCtx*>& result);
|
||||
|
||||
/*!
|
||||
* @return the cache size set for this RsGeneralDataService
|
||||
*/
|
||||
uint32_t cacheSize() const;
|
||||
|
||||
|
||||
/*!
|
||||
* Stores a list signed messages into data store
|
||||
* @param msg list of signed messages to store
|
||||
* @return error code
|
||||
*/
|
||||
int storeMessage(std::set<RsNxsMsg*>& msg);
|
||||
|
||||
/*!
|
||||
* Stores a list of groups in data store
|
||||
* @param msg list of messages
|
||||
* @return error code
|
||||
*/
|
||||
int storeGroup(std::set<RsNxsGrp*>& grp);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
RsNxsMsg* getMessage(RetroCursor& c);
|
||||
RsNxsGrp* getGroup(RetroCursor& c);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
RetroDb* mDb;
|
||||
std::list<std::string> msgColumns;
|
||||
std::list<std::string> grpColumns;
|
||||
};
|
||||
|
||||
#endif // RSDATASERVICE_H
|
@ -1,5 +1,5 @@
|
||||
#ifndef RSGDP_H
|
||||
#define RSGDP_H
|
||||
#ifndef RSGDS_H
|
||||
#define RSGDS_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/gxp: gxp.h
|
||||
@ -33,28 +33,14 @@
|
||||
#include "inttypes.h"
|
||||
#include "rsgnp.h"
|
||||
|
||||
#include "serialiser/rsgxsitems.h"
|
||||
#include "serialiser/rsnxsitems.h"
|
||||
|
||||
#include "gxs/rsgxs.h"
|
||||
|
||||
|
||||
class RsGxsSignedMsg {
|
||||
|
||||
|
||||
RsGxsMsgId mMsgId;
|
||||
RsTlvBinaryData mMsgData;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Might be better off simply sending request codes
|
||||
*
|
||||
*/
|
||||
class RsGxsSearch {
|
||||
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
virtual int code() = 0;
|
||||
};
|
||||
|
||||
/*!
|
||||
* The main role of GDS is the preparation and handing out of messages requested from
|
||||
* RsGeneralExchangeService and RsGeneralExchangeService
|
||||
@ -83,36 +69,52 @@ public:
|
||||
|
||||
/*!
|
||||
* Retrieves signed message
|
||||
* @param msgGrp this contains grp and the message to retrieve
|
||||
* @param msgIds ids of messagesto retrieve
|
||||
* @param msg result of msg retrieval
|
||||
* @param cache whether to store retrieval in memory for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
virtual int retrieveMsgs(const std::list<RsGxsMsgId>& msgId, std::set<RsGxsMsg*> msg, bool cache) = 0;
|
||||
virtual int retrieveMsgs(const std::list<std::string>& msgIds, std::set<RsGxsMsg*> msg, bool cache) = 0;
|
||||
|
||||
/*!
|
||||
* Retrieves a group item by grpId
|
||||
* @param grpId the ID of the group to retrieve
|
||||
* @param grpId the Id of the groups to retrieve
|
||||
* @param grp results of retrieval
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
virtual int retrieveGrps(const std::list<RsGxsGrpId>& grpId, std::set<RsGxsGroup*> grp, bool cache) = 0;
|
||||
virtual int retrieveGrps(const std::list<std::string>& grpId, std::set<RsGxsGroup*>& grp, bool cache) = 0;
|
||||
|
||||
/*!
|
||||
* @param grpId the id of the group to get versions for
|
||||
* @param cache whether to store the result in memory
|
||||
* @param errCode
|
||||
*/
|
||||
virtual int retrieveGrpVersions(const std::string& grpId, std::set<RsGxsGroup*>& grp, bool cache);
|
||||
|
||||
/*!
|
||||
* @param msgId the id of the message to get versions for
|
||||
* @param cache whether to store the result in memory
|
||||
* @param errCode
|
||||
*/
|
||||
virtual int retrieveMsgVersions(const std::string& grpId, std::set<RsGxsGroup*> grp, bool cache);
|
||||
|
||||
|
||||
/*!
|
||||
* allows for more complex queries specific to the service
|
||||
* BLOBs type columns will not be searched
|
||||
* @param search generally stores parameters needed for query
|
||||
* @param msgId is set with msg ids which satisfy the gxs search
|
||||
* @return error code
|
||||
*/
|
||||
virtual int searchMsgs(RsGxsSearch* search, std::list<RsMsgId>& msgId) = 0;
|
||||
virtual int searchMsgs(RsGxsSearch* search, std::list<RsGxsSrchResMsgCtx*>& result) = 0;
|
||||
|
||||
/*!
|
||||
* allows for more complex queries specific to the associated service
|
||||
* BLOBs type columns will not be searched
|
||||
* @param search generally stores parameters needed for query
|
||||
* @param msgId is set with msg ids which satisfy the gxs search
|
||||
* @return error code
|
||||
*/
|
||||
virtual int searchGrps(RsGxsSearch* search, std::list<RsGroupId>& grpId) = 0;
|
||||
virtual int searchGrps(RsGxsSearch* search, std::list<RsGxsSrchResGrpCtx*>& result) = 0;
|
||||
|
||||
/*!
|
||||
* @return the cache size set for this RsGeneralDataService
|
||||
@ -125,44 +127,14 @@ public:
|
||||
* @param msg list of signed messages to store
|
||||
* @return error code
|
||||
*/
|
||||
virtual int storeMessage(std::set<RsGxsSignedMsg*> msg) = 0;
|
||||
virtual int storeMessage(std::set<RsNxsMsg*>& msg) = 0;
|
||||
|
||||
/*!
|
||||
* Stores a list of groups in data store
|
||||
* @param msg list of messages
|
||||
* @return error code
|
||||
*/
|
||||
virtual int storeGroup(std::set<RsGxsGroup*> grp) = 0;
|
||||
|
||||
/*!
|
||||
* Retrieves group ids
|
||||
* @param grpIds
|
||||
*/
|
||||
virtual void retrieveGrpIds(std::list<std::string>& grpIds) = 0;
|
||||
|
||||
|
||||
/*!
|
||||
* Retrieves msg ids
|
||||
*/
|
||||
virtual void retrieveMsgIds(std::list<std::string>& msgIds) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/*!
|
||||
* Retrieves signed message
|
||||
* @param msgGrp this contains grp and the message to retrieve
|
||||
* @return request code to be redeemed later
|
||||
*/
|
||||
virtual int retrieveMsgs(const std::list<RsGxsMsgId>& msgId, std::set<RsGxsMsg*> msg) = 0;
|
||||
|
||||
/*!
|
||||
* Retrieves a group item by grpId
|
||||
* @param grpId the ID of the group to retrieve
|
||||
* @return request code to be redeemed later
|
||||
*/
|
||||
virtual int retrieveGrps(const std::list<RsGxsGrpId>& grpId, std::set<RsGxsGroup*> grp) = 0;
|
||||
virtual int storeGroup(std::set<RsNxsGrp*>& grp) = 0;
|
||||
|
||||
|
||||
};
|
||||
@ -170,4 +142,4 @@ protected:
|
||||
|
||||
|
||||
|
||||
#endif // RSGDP_H
|
||||
#endif // RSGDS_H
|
@ -38,8 +38,7 @@
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "rsgixs.h"
|
||||
#include "rsgdp.h"
|
||||
#include "serialiser/rsgxsitems.h"
|
||||
|
||||
#define GXS_STATUS_GRP_NOT_FOUND 1 /* request resulted in grp not found error */
|
||||
#define GXS_STATUS_MSG_NOT_FOUND 2 /* request resulted in msg not found */
|
||||
@ -47,69 +46,39 @@
|
||||
#define GXS_STATUS_OK 4 /* request was successful */
|
||||
|
||||
|
||||
|
||||
class RsGxsMsgId {
|
||||
|
||||
public:
|
||||
|
||||
std::string grpId;
|
||||
std::string msgId;
|
||||
};
|
||||
|
||||
|
||||
class RsGxsGrpId {
|
||||
|
||||
public:
|
||||
|
||||
std::string grpId;
|
||||
RsTlvKeySignature adminSign;
|
||||
};
|
||||
|
||||
typedef time_t RsGxsTime;
|
||||
typedef std::map<std::string, uint32_t> IdVersionM;
|
||||
typedef std::multimap<std::string, std::pair<std::string, uint32_t> > GrpMsgMap;
|
||||
typedef uint64_t RsGroupId ;
|
||||
|
||||
class RsGxsLink
|
||||
{
|
||||
uint32_t type;
|
||||
std::string msgId;
|
||||
};
|
||||
|
||||
class RsGxsGrpId{
|
||||
class RsGxsSearchModule {
|
||||
|
||||
public:
|
||||
|
||||
std::string grpId;
|
||||
uint32_t version;
|
||||
virtual bool searchMsg(const RsGxsSearch&, RsGxsMsg* msg) = 0;
|
||||
virtual bool searchGroup(const RsGxsSearch&, RsGxsGroup* grp) = 0;
|
||||
|
||||
};
|
||||
|
||||
class RsGxsGroup {
|
||||
std::set<uint32_t> version;
|
||||
};
|
||||
|
||||
|
||||
class RsGxsMsgId {
|
||||
|
||||
public:
|
||||
std::string mMsgId;
|
||||
std::string mGrpId;
|
||||
uint32_t mVersion;
|
||||
|
||||
};
|
||||
|
||||
class RsGxsSearchResult {
|
||||
|
||||
};
|
||||
|
||||
class RsGxsMsg
|
||||
{
|
||||
|
||||
RsGxsMsgId mId;
|
||||
|
||||
std::string mMsgId;
|
||||
std::string mOrigMsgId;
|
||||
|
||||
RsGxsTime mTime;
|
||||
std::list<std::string> mHashtags;
|
||||
std::list<RsGxsLink> mLinked;
|
||||
std::set<uint32_t> mVersions;
|
||||
RsGxsSignature mPersonalSignature;
|
||||
RsGxsSignature mPublishSignature;
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* This provides a base class which
|
||||
* can be intepreted by the service
|
||||
* into concrete search terms
|
||||
*/
|
||||
class RsGxsSearchItem {
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
* The whole idea is to provide a broad enough base class from which
|
||||
@ -143,48 +112,33 @@ class RsGxsService
|
||||
|
||||
public:
|
||||
|
||||
RsGxsService(RsGxsSearchModule* mod);
|
||||
virtual ~RsGxsService();
|
||||
|
||||
/***************** Group request receive API ********************/
|
||||
|
||||
/*!
|
||||
* Request group, not intialising version member of RsGxsGrpId
|
||||
* results in the latest version of groups being returned
|
||||
* @param grpIds the id/version of the group requested
|
||||
* @return token for request
|
||||
* @see receiveGrp()
|
||||
*/
|
||||
int requestGrp(std::list<RsGxsGrpId>& grpIds);
|
||||
int requestGrps();
|
||||
|
||||
/*!
|
||||
* Request group, not intialising version member of RsGxsGrpId
|
||||
* results in the latest version of group being returned
|
||||
* @param grpIds the id/version of the group requested
|
||||
* @return token for request
|
||||
* @see receiveGrpList()
|
||||
*/
|
||||
int requestSubscribedGrpList();
|
||||
int requestSubscribedGrps();
|
||||
|
||||
/*!
|
||||
* pulls in all grps held by peer
|
||||
* @param grpIds the id/version of the group requested
|
||||
* @return token for request
|
||||
* @see receiveGrp()
|
||||
*/
|
||||
int requestPeersGrps(const std::string& sslId);
|
||||
|
||||
|
||||
/*!
|
||||
* returns Ids of groups which are still in valid time range
|
||||
* Request all versions of a group
|
||||
* @param grpId group id to request version for
|
||||
* @return token for request
|
||||
*/
|
||||
int requestGrpList();
|
||||
|
||||
/*!
|
||||
* @param token the token to be redeemed
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param grpList list of group ids associated to request token
|
||||
*/
|
||||
virtual void receiveGrpList(int token, int errCode, std::list<RsGxsGrpId>& grpList) = 0;
|
||||
int requestAllGrpVersions(const std::string& grpId);
|
||||
|
||||
/*!
|
||||
* Event call back from Gxs runner
|
||||
@ -195,34 +149,34 @@ public:
|
||||
*/
|
||||
virtual void receiveGrp(int token, int errCode, std::set<RsGxsGroup*>& grps) = 0;
|
||||
|
||||
|
||||
/*************** Start: Msg request receive API ********************/
|
||||
|
||||
/* Messages a level below grps on the hiearchy hence group requests */
|
||||
/* are intrinsically linked to their grp Id */
|
||||
|
||||
|
||||
/*!
|
||||
* request latest version of messages for group
|
||||
* @param token for request
|
||||
* @see receiveMsg()
|
||||
*/
|
||||
int requestGrpMsgs(std::list<RsGxsGrpId>&);
|
||||
|
||||
/*!
|
||||
* More fine grained request of msgs
|
||||
* @param msgs the message to request, based on id, and version
|
||||
* @param token for request
|
||||
* @see receiveMsg()
|
||||
*/
|
||||
int requestMsgs(std::list<RsGxsMsgId>& msgs);
|
||||
|
||||
/*!
|
||||
* pulls in all data held by peer
|
||||
* @param grpIds the id/version of the group requested
|
||||
* request latest version of messages for groups
|
||||
* listed
|
||||
* @param grpIds list of grpIds to get msgs for
|
||||
* @return token for request
|
||||
* @see receiveMsg()
|
||||
*/
|
||||
int requestPeersMsgs(std::string sslId, const RsGxsGrpId& grpId);
|
||||
int requestGrpMsgs(const std::list<string>& grpIds);
|
||||
|
||||
/*!
|
||||
* request latest version of messages for group
|
||||
* @param grpIds list of grpIds to get msgs for
|
||||
* @return token for request
|
||||
* @see receiveMsg()
|
||||
*/
|
||||
int requestAllMsgVersions(const std::list<RsGxsMsgId>& msgIds);
|
||||
|
||||
/*!
|
||||
*
|
||||
*
|
||||
*/
|
||||
int requestMsgVersion(const RsGxsMsgId& msgId);
|
||||
|
||||
/*!
|
||||
* Event call back from GxsRunner
|
||||
@ -231,31 +185,6 @@ public:
|
||||
*/
|
||||
virtual void receiveMsg(int token, int errCode, std::set<RsGxsMsg*>& msgs) = 0;
|
||||
|
||||
/*!
|
||||
* request message ids for grp
|
||||
* @param msgIdSet set of id for msg
|
||||
* @return token to be redeemed
|
||||
*/
|
||||
int requestGrpMsgIdList(std::list<RsGxsGrpId>& msgIds);
|
||||
|
||||
|
||||
/*!
|
||||
*
|
||||
* @param token to be redeemed
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param the msgIdSet associated to request token
|
||||
*/
|
||||
virtual void receiveMsgIdList(int token, int errCode, std::list<RsGxsMsgId>& msgIdList) = 0;
|
||||
|
||||
|
||||
/*!
|
||||
* @param searchToken token to be redeemed
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param result result set
|
||||
*/
|
||||
void receivedSearchResult(int searchToken, int errCode, std::set<RsGxsSearchResult*> results);
|
||||
|
||||
|
||||
/*************** End: Msg request receive API ********************/
|
||||
|
||||
|
||||
@ -282,9 +211,10 @@ public:
|
||||
* Pushes a RsGxsGroup on RsGxsNetwork and associates it with a \n
|
||||
* given RsGixs profile
|
||||
* @param grp group to push onto network
|
||||
|
||||
* @return error code
|
||||
*/
|
||||
int pushGrp(std::set<RsGxsGroup*>& grp, std::string& profileName);
|
||||
int pushGrp(const RsGxsGroup& grp);
|
||||
|
||||
/*!
|
||||
* Update an already published group with
|
||||
@ -293,20 +223,8 @@ public:
|
||||
* @param grp grp to update
|
||||
* @return token to be redeemed
|
||||
*/
|
||||
int updateGrp(std::set<RsGxsGroup*>& grp);
|
||||
int updateGrp(const RsGxsGroup& grp);
|
||||
|
||||
/*!
|
||||
* Pushes a set of RsGxsGroups onto RsGxs network, associates it with an RsGixs profile to be
|
||||
* created given the parameters below
|
||||
* @param grp set of messages to push onto service for publication
|
||||
* @param type the type of identity to create
|
||||
* @param peers peers to share this identity with
|
||||
* @param pseudonym if type is pseudonym then uses this as the name of the pseudonym Identity
|
||||
* @return token to be redeemed
|
||||
* @see errorMsg
|
||||
*/
|
||||
int pushGrp(std::set<RsGxsGroup*>& grp, RsIdentityExchangeService::IdentityType type, const std::set<std::string>& peers,
|
||||
const std::string& pseudonymName = "");
|
||||
|
||||
/*********** End: publication *****************/
|
||||
|
||||
@ -315,17 +233,10 @@ public:
|
||||
// Thus a
|
||||
// This is a configuration thing.
|
||||
/*************************************************************************/
|
||||
/*********** Start: Identity control and groups *****************/
|
||||
/*********** Start: groups *****************/
|
||||
|
||||
|
||||
/*!
|
||||
* can choose the share created identity immediately or use identity service later to share it
|
||||
* if type is pseudonym and pseudonym field is empty, identity creation will fail
|
||||
* @param group is now associated
|
||||
*/
|
||||
void getProfile(std::string profileName);
|
||||
|
||||
/*!
|
||||
*
|
||||
* This says listed group can are only ones that can
|
||||
* share grp/msgs between themselves for grpId
|
||||
* Default behaviour on group sharing is share with between all peers
|
||||
@ -333,7 +244,7 @@ public:
|
||||
* @param grpId groupId that share behaviour is being set
|
||||
* @return status token to be redeemed
|
||||
*/
|
||||
int setShareGroup(const std::list<RsGroupId>& rsGrpId, const RsGxsGrpId& grpId);
|
||||
int setShareGroup(const std::list<RsGroupId>& rsGrpId, const std::string grpId);
|
||||
|
||||
/*********** End: Identity control and groups *****************/
|
||||
|
||||
@ -347,7 +258,7 @@ public:
|
||||
/*********** Start: Update of groups/messages locally *****************/
|
||||
|
||||
/*!
|
||||
* To flags message as read or not read in store
|
||||
* flags latest message in store as read or not read
|
||||
* @param GrpMsgMap flags this msg,version pair as read
|
||||
* @param read set to true for read and false for unread
|
||||
*/
|
||||
@ -359,7 +270,7 @@ public:
|
||||
* @param grpId the
|
||||
* @param
|
||||
*/
|
||||
int flagGroupRead(const RsGxsGrpId& grpId, bool read);
|
||||
int flagGroupRead(const std::string grpId, bool read);
|
||||
|
||||
/*!
|
||||
* This marks a local message created by yourself to
|
||||
@ -369,14 +280,14 @@ public:
|
||||
* should be removed
|
||||
* @param msgId
|
||||
*/
|
||||
int requestDeleteMsg(const RsGxsMsgId& msgId);
|
||||
int requestDeleteMsg(const RsGxsMsg& msg);
|
||||
|
||||
/*!
|
||||
* This is grpId is marked in database to be removed
|
||||
* and not circulated. Entry will later be removed
|
||||
* once discard age is reached
|
||||
*/
|
||||
int requestDeleteGrp(const RsGxsGrpId& grpId);
|
||||
int requestDeleteGrp(const RsGxsGroup& grp);
|
||||
|
||||
|
||||
/******************* Start: Configuration *************************/
|
||||
@ -409,7 +320,7 @@ public:
|
||||
* @param subscribe set to false to unsubscribe and true otherwise
|
||||
* @return token to redeem
|
||||
*/
|
||||
int requestSubscribeToGrp(const RsGxsGrpId& grpId, bool subscribe);
|
||||
int requestSubscribeToGrp(const std::string& grpId, bool subscribe);
|
||||
|
||||
/*!
|
||||
* This called by event runner on status of subscription
|
||||
@ -417,7 +328,7 @@ public:
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param gxsStatus the status of subscription request
|
||||
*/
|
||||
virtual void receiveSubscribeToGrp(int token, int errCode, int gxsStatus) = 0;
|
||||
virtual void receiveSubscribeToGrp(int token, int errCode) = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
@ -435,7 +346,7 @@ public:
|
||||
* have been updated or newly arrived
|
||||
* @param grpId ids of groups that have changed or newly arrived
|
||||
*/
|
||||
virtual void notifyGroupChanged(std::list<RsGxsGrpId> grpId) = 0;
|
||||
virtual void notifyGroupChanged(std::list<std::string> grpIds) = 0;
|
||||
|
||||
|
||||
/*!
|
||||
@ -490,7 +401,7 @@ public:
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param grpIds list of grp ids
|
||||
*/
|
||||
virtual void receiveLocalSearchGrps(int token, int errCode, std::list<RsGxsGrpId>& grpIds);
|
||||
virtual void receiveLocalSearchGrps(int token, int errCode, std::list<RsGxsGroup*>& grps);
|
||||
|
||||
/*!
|
||||
*
|
||||
@ -498,7 +409,7 @@ public:
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param msgIds the message ids that contain contain search term
|
||||
*/
|
||||
virtual void receiveLocalSearchMsgs(int token, int errCode, std::list<RsGxsMsgId> &msgIds) = 0;
|
||||
virtual void receiveLocalSearchMsgs(int token, int errCode, std::list<RsGxsMsg*> &msgs) = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
@ -506,7 +417,7 @@ public:
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param grps
|
||||
*/
|
||||
virtual void receiveRemoteSearchGrps(int token, int errCode, std::list<RsGxsGrpId>& grps) = 0;
|
||||
virtual void receiveRemoteSearchGrps(int token, int errCode, std::list<RsGxsGroup*>& grps) = 0;
|
||||
|
||||
/*!
|
||||
*
|
||||
@ -514,7 +425,7 @@ public:
|
||||
* @param errCode error code, can be exchanged for error string
|
||||
* @param msgIds
|
||||
*/
|
||||
virtual void recieveRemoteSearchMsgs(int token, int errCode, std::list<RsGxsMsgId>& msgs) = 0;
|
||||
virtual void recieveRemoteSearchMsgs(int token, int errCode, std::list<RsGxsMsg*>& msgs) = 0;
|
||||
|
||||
/*!
|
||||
* Note if parent group is not present this will be requested \n
|
||||
@ -523,17 +434,24 @@ public:
|
||||
* @return token to be redeemed
|
||||
* @see receiveMsg()
|
||||
*/
|
||||
int requestRemoteMsg(std::list<RsGxsMsgId> msgIds);
|
||||
virtual int requestRemoteMsg(std::list<RsGxsMsgId>& msgIds);
|
||||
|
||||
/*!
|
||||
* @param grpIds the ids of the group being requested
|
||||
* @return token to be redeemed
|
||||
* @see receiveGrp()
|
||||
*/
|
||||
int requestRemoteGrp(std::list<RsGxsGrpId>& grpIds);
|
||||
virtual int requestRemoteGrp(std::list<RsGxsGrpId>& grpIds);
|
||||
|
||||
/****************** End: Search from event runner ***************/
|
||||
|
||||
/*!
|
||||
* @param msgIds ids of messages to be deleted
|
||||
* @return token to be redeemed
|
||||
*/
|
||||
virtual int deleteRemoteMsg(std::list<RsGxsMsgId>& msgIds);
|
||||
|
||||
virtual int deleteRemoteGrp(std::list<RsGxsGrpId>& grpIds);
|
||||
};
|
||||
|
||||
#endif // RSGXS_H
|
||||
|
Loading…
Reference in New Issue
Block a user