mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
5fbd591517
started implementing gen exchange client calls finished implementing msgrelated info dataAccess routine more refinements to various interface - need to think about how meta is passed about the various layers of gxs and kept consistent with sqldb git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5321 b45a01b8-16f6-495d-af2f-9b41ad6348cc
188 lines
5.7 KiB
C++
188 lines
5.7 KiB
C++
#ifndef RSGDS_H
|
|
#define RSGDS_H
|
|
|
|
/*
|
|
* libretroshare/src/gxp: gxp.h
|
|
*
|
|
* General Data service, interface for RetroShare.
|
|
*
|
|
* Copyright 2011-2011 by Robert Fernie, Evi-Parker Christopher
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
* USA.
|
|
*
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
*
|
|
*/
|
|
|
|
#include <set>
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include "inttypes.h"
|
|
|
|
#include "serialiser/rsgxsitems.h"
|
|
#include "serialiser/rsnxsitems.h"
|
|
#include "gxs/rsgxsdata.h"
|
|
|
|
|
|
class RsGxsSearchModule {
|
|
|
|
public:
|
|
|
|
virtual ~RsGxsSearchModule();
|
|
|
|
|
|
};
|
|
|
|
class MsgLocMetaData {
|
|
|
|
};
|
|
|
|
class GrpLocMetaData {
|
|
|
|
};
|
|
|
|
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgReq; // <grpId, msgIds>
|
|
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > GxsMsgResult; // <grpId, msgs>
|
|
typedef std::map<RsGxsGroupId, std::vector<RsGxsMsgMetaData*> > GxsMsgMetaResult; // <grpId, msg metadatas>
|
|
|
|
/*!
|
|
* The main role of GDS is the preparation and handing out of messages requested from
|
|
* RsGeneralExchangeService and RsGeneralExchangeService
|
|
* It is important to note that no actual messages are passed by this interface as its is expected
|
|
* architecturally to pass messages to the service via a call back
|
|
*
|
|
* It also acts as a layer between RsGeneralStorageService and its parent RsGeneralExchangeService
|
|
* thus allowing for non-blocking requests, etc.
|
|
* It also provides caching ability
|
|
*
|
|
*
|
|
* Caching feature:
|
|
* - A cache index should be maintained which is faster than normal message request
|
|
* - This should allow fast retrieval of message based on grp id or msg id
|
|
*
|
|
* Identity Exchange Service:
|
|
* - As this is the point where data is accessed by both the GNP and GXS the identities
|
|
* used to decrypt, encrypt and verify is handle here.
|
|
*
|
|
* Please note all function are blocking.
|
|
*/
|
|
class RsGeneralDataService
|
|
{
|
|
|
|
public:
|
|
|
|
RsGeneralDataService(){}
|
|
virtual ~RsGeneralDataService(){return;}
|
|
|
|
/*!
|
|
* 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 results of this retrieval in memory for faster later retrieval
|
|
* @return error code
|
|
*/
|
|
virtual int retrieveNxsMsgs(const GxsMsgReq& reqIds, GxsMsgResult& msg, bool cache) = 0;
|
|
|
|
/*!
|
|
* Retrieves all groups stored
|
|
* @param grp retrieved groups
|
|
* @param cache whether to store retrieval in mem for faster later retrieval
|
|
* @return error code
|
|
*/
|
|
virtual int retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp*>& grp, bool cache) = 0;
|
|
|
|
/*!
|
|
* Retrieves meta data of all groups stored (most current versions only)
|
|
*
|
|
* @param grp if null grpIds entries are made, only meta for those grpId are retrieved \n
|
|
* , if grpId is failed to be retrieved it will be erased from map
|
|
* @return error code
|
|
*/
|
|
virtual int retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaData*>& grp) = 0;
|
|
|
|
/*!
|
|
* 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
|
|
*/
|
|
virtual int retrieveGxsMsgMetaData(const std::vector<std::string>& grpIds, GxsMsgMetaResult& msgMeta) = 0;
|
|
|
|
/*!
|
|
* remove msgs in data store listed in msgIds param
|
|
* @param msgIds ids of messages to be removed
|
|
* @return error code
|
|
*/
|
|
virtual int removeMsgs(const GxsMsgReq& msgIds) = 0;
|
|
|
|
/*!
|
|
* remove groups in data store listed in grpIds param
|
|
* @param grpIds ids of groups to be removed
|
|
* @return error code
|
|
*/
|
|
virtual int removeGroups(const std::vector<RsGxsGroupId>& grpIds) = 0;
|
|
|
|
/*!
|
|
* @return the cache size set for this RsGeneralDataService in bytes
|
|
*/
|
|
virtual uint32_t cacheSize() const = 0;
|
|
|
|
/*!
|
|
* @param size size of cache to set in bytes
|
|
*/
|
|
virtual int setCacheSize(uint32_t size) = 0;
|
|
|
|
/*!
|
|
* Stores a list of signed messages into data store
|
|
* @param msg map of message and decoded meta data information
|
|
* @return error code
|
|
*/
|
|
virtual int storeMessage(std::map<RsNxsMsg*, RsGxsMsgMetaData*>& msg) = 0;
|
|
|
|
/*!
|
|
* Stores a list of groups in data store
|
|
* @param grp map of group and decoded meta data
|
|
* @return error code
|
|
*/
|
|
virtual int storeGroup(std::map<RsNxsGrp*, RsGxsGrpMetaData*>& grp) = 0;
|
|
|
|
|
|
/*!
|
|
* @param metaData
|
|
*/
|
|
virtual int updateMessageMetaData(MsgLocMetaData* metaData) = 0;
|
|
|
|
/*!
|
|
* @param metaData
|
|
*/
|
|
virtual int updateGroupMetaData(GrpLocMetaData* meta) = 0;
|
|
|
|
|
|
/*!
|
|
* Completely clear out data stored in
|
|
* and returns this to a state
|
|
* as it was when first constructed
|
|
*/
|
|
virtual int resetDataStore() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // RSGDS_H
|