implemented most of rsdataservice,

updated rsnxsitems with discrete msgs and grp item rather than collection of msgs/grps
added flags header file 
added first declaration of implemented genexchange service (client API interface)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5180 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-05-21 22:07:43 +00:00
parent f05ed342ed
commit add4715da0
16 changed files with 1179 additions and 554 deletions

View file

@ -9,41 +9,54 @@ class RsDataService : public RsGeneralDataService
{
public:
RsDataService(const std::string& workingDir, const std::string& dbName, uint16_t serviceType);
RsDataService(const std::string& serviceDir, const std::string& dbName, uint16_t serviceType, RsGxsSearchModule* mod = NULL);
virtual ~RsDataService();
/*!
* Retrieves signed message
* Retrieves latest version of msgs for a service
* @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);
int retrieveMsgs(const std::string& grpId, std::map<std::string, RsGxsMsg*> msg, bool cache);
/*!
* Retrieves a group item by grpId
* Retrieves latest version of groups for a service
* @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);
int retrieveGrps(std::set<std::string, RsGxsGroup*>& 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
* @param errCode
* @return errCode
*/
int retrieveGrpVersions(const std::string& grpId, std::set<RsGxsGroup*>& grp, bool cache);
int retrieveGrpVersions(const std::string &grpId, std::set<RsNxsGrp *> &grp, bool cache);
/*!
* retrieves all the versions of a message for a group
* @param grpId the id of the group message belongs to
* @param msgId the id of the message to get versions for
* @param cache whether to store the result in memory
* @param errCode
* @return errCode
*/
int retrieveMsgVersions(const std::string& grpId, std::set<RsGxsGroup*> grp, bool cache);
int retrieveMsgVersions(const std::string &grpId, const std::string msgId, std::set<RsNxsMsg *> grp, bool cache);
/*!
* @param msgId the id of the message to retrieve
* @return NULL if message does not exist, or pointer to grp if found
*/
RsNxsMsg* retrieveMsgVersion(const RsGxsMsgId& msgId);
/*!
* @param grpId the id of the group to retrieve
* @return NULL if group does not exist or pointer to grp if found
*/
RsNxsGrp* retrieveGrpVersion(const RsGxsGrpId& grpId);
/*!
* allows for more complex queries specific to the service
@ -62,10 +75,14 @@ public:
int searchGrps(RsGxsSearch* search, std::list<RsGxsSrchResGrpCtx*>& result);
/*!
* @return the cache size set for this RsGeneralDataService
* @return the cache size set for this RsGeneralDataService in bytes
*/
uint32_t cacheSize() const;
/*!
* @param size size of cache to set in bytes
*/
virtual int setCacheSize(uint32_t size);
/*!
* Stores a list signed messages into data store
@ -87,13 +104,15 @@ private:
RsNxsMsg* getMessage(RetroCursor& c);
RsNxsGrp* getGroup(RetroCursor& c);
private:
RetroDb* mDb;
std::list<std::string> msgColumns;
std::list<std::string> grpColumns;
std::string mServiceDir, mDbName;
uint16_t mServType;
};
#endif // RSDATASERVICE_H