mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-22 21:34:32 -04:00
Nxs items now do not support the concept of version
timestamp has been added to grp sync item updated data service and grps to deal with this added msg and grp meta types which serves to hold meta data of grp and msg removed observer temporarily updated nxs item tests, need to update data service tests git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5256 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
03e2ee72e0
commit
d533a2e580
15 changed files with 965 additions and 729 deletions
|
@ -13,67 +13,52 @@ public:
|
|||
virtual ~RsDataService();
|
||||
|
||||
/*!
|
||||
* Retrieves latest version of msgs for a service
|
||||
* @param msgIds ids of messagesto retrieve
|
||||
* Retrieves all msgs
|
||||
* @param reqIds requested msg ids (grpId,msgId), leave msg list empty to get all msgs for the grp
|
||||
* @param msg result of msg retrieval
|
||||
* @param cache whether to store retrieval in memory for faster later retrieval
|
||||
* @param cache whether to store results of this retrieval in memory for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveMsgs(const std::string& grpId, std::map<std::string, RsNxsMsg*>& msg, bool cache);
|
||||
int retrieveNxsMsgs(const GxsMsgReq& reqIds, GxsMsgResult& msg, bool cache);
|
||||
|
||||
/*!
|
||||
* Retrieves latest version of groups for a service
|
||||
* @param grpId the Id of the groups to retrieve
|
||||
* @param grp results of retrieval
|
||||
* Retrieves all groups stored (most current versions only)
|
||||
* @param grp retrieved groups
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveGrps(std::map<std::string, RsNxsGrp*>& grp, bool cache);
|
||||
int retrieveNxsGrps(std::map<std::string, RsNxsGrp*>& grp, bool cache);
|
||||
|
||||
/*!
|
||||
* Retrieves all the versions of a group
|
||||
* @param grpId the id of the group to get versions for
|
||||
* @param cache whether to store the result in memory
|
||||
* @return errCode
|
||||
* Retrieves meta data of all groups stored (most current versions only)
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveGrpVersions(const std::string &grpId, std::set<RsNxsGrp *> &grp, bool cache);
|
||||
int retrieveGxsGrpMetaData(std::map<std::string, RsGxsGrpMetaData*>& grp);
|
||||
|
||||
/*!
|
||||
* @param grpId the id of the group to retrieve
|
||||
* @return NULL if group does not exist or pointer to grp if found
|
||||
* Retrieves meta data of all groups stored (most current versions only)
|
||||
* @param grpIds grpIds for which to retrieve meta data
|
||||
* @param msgMeta meta data result as map of grpIds to array of metadata for that grpId
|
||||
* @param cache whether to store retrieval in mem for faster later retrieval
|
||||
* @return error code
|
||||
*/
|
||||
RsNxsGrp* retrieveGrpVersion(const RsGxsGrpId& grpId);
|
||||
int retrieveGxsMsgMetaData(const std::vector<std::string>& grpIds, GxsMsgMetaResult& msgMeta);
|
||||
|
||||
/*!
|
||||
* remove msgs in data store listed in msgIds param
|
||||
* remove msgs in data store
|
||||
* @param grpId group Id of message to be removed
|
||||
* @param msgIds ids of messages to be removed
|
||||
* @return error code
|
||||
*/
|
||||
int removeMsgs(const std::list<RsGxsMsgId>& msgIds);
|
||||
int removeMsgs(const std::string grpId, const std::vector<std::string>& msgIds);
|
||||
|
||||
/*!
|
||||
* remove groups in data store listed in grpIds param
|
||||
* @param grpIds ids of groups to be removed
|
||||
* @return error code
|
||||
*/
|
||||
int removeGroups(const std::list<RsGxsGrpId>& grpIds);
|
||||
|
||||
|
||||
/*!
|
||||
* 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);
|
||||
int removeGroups(const std::vector<std::string>& grpIds);
|
||||
|
||||
/*!
|
||||
* @return the cache size set for this RsGeneralDataService in bytes
|
||||
|
@ -83,43 +68,92 @@ public:
|
|||
/*!
|
||||
* @param size size of cache to set in bytes
|
||||
*/
|
||||
virtual int setCacheSize(uint32_t size);
|
||||
int setCacheSize(uint32_t size);
|
||||
|
||||
/*!
|
||||
* Stores a list signed messages into data store
|
||||
* @param msg list of signed messages to store
|
||||
* Stores a list of signed messages into data store
|
||||
* @param msg map of message and decoded meta data information
|
||||
* @return error code
|
||||
*/
|
||||
int storeMessage(std::set<RsNxsMsg*>& msg);
|
||||
int storeMessage(std::map<RsNxsMsg*, RsGxsMsgMetaData*>& msg);
|
||||
|
||||
/*!
|
||||
* Stores a list of groups in data store
|
||||
* @param msg list of messages
|
||||
* @param grp map of group and decoded meta data
|
||||
* @return error code
|
||||
*/
|
||||
int storeGroup(std::set<RsNxsGrp*>& grp);
|
||||
int storeGroup(std::map<RsNxsGrp*, RsGxsGrpMetaData*>& grp);
|
||||
|
||||
/*!
|
||||
* @param metaData The meta data item to update
|
||||
* @return error code
|
||||
*/
|
||||
int updateMessageMetaData(MsgLocMetaData* metaData);
|
||||
|
||||
/*!
|
||||
* @param metaData The meta data item to update
|
||||
* @return error code
|
||||
*/
|
||||
int updateGroupMetaData(GrpLocMetaData* meta);
|
||||
|
||||
|
||||
/*!
|
||||
* Completely clear out data stored in
|
||||
* this data store and returns this to a state
|
||||
* and returns this to a state
|
||||
* as it was when first constructed
|
||||
* This also clears any data store items created in service directory
|
||||
* @return error code
|
||||
*/
|
||||
int resetDataStore();
|
||||
|
||||
private:
|
||||
|
||||
/*!
|
||||
* Retrieves all the msg results from a cursor
|
||||
* @param c cursor to result set
|
||||
* @param msgs messages retrieved from cursor are stored here
|
||||
*/
|
||||
void retrieveMessages(RetroCursor* c, std::vector<RsNxsMsg*>& msgs);
|
||||
|
||||
/*!
|
||||
* extracts a msg meta item from a cursor at its
|
||||
* current position
|
||||
*/
|
||||
RsGxsMsgMetaData* getMsgMeta(RetroCursor& c);
|
||||
|
||||
/*!
|
||||
* extracts a grp meta item from a cursor at its
|
||||
* current position
|
||||
*/
|
||||
RsGxsGrpMetaData* getGrpMeta(RetroCursor& c);
|
||||
|
||||
/*!
|
||||
* extracts a msg item from a cursor at its
|
||||
* current position
|
||||
*/
|
||||
RsNxsMsg* getMessage(RetroCursor& c);
|
||||
|
||||
/*!
|
||||
* extracts a grp item from a cursor at its
|
||||
* current position
|
||||
*/
|
||||
RsNxsGrp* getGroup(RetroCursor& c);
|
||||
|
||||
/*!
|
||||
* Creates an sql database and its associated file
|
||||
* also creates the message and groups table
|
||||
*/
|
||||
void initialise();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
RetroDb* mDb;
|
||||
|
||||
std::list<std::string> msgColumns;
|
||||
std::list<std::string> msgMetaColumns;
|
||||
|
||||
std::list<std::string> grpColumns;
|
||||
std::list<std::string> grpMetaColumns;
|
||||
|
||||
std::string mServiceDir, mDbName;
|
||||
uint16_t mServType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue