Removed most of the interface for RsGNP as it mostly makes calls to other components

Added final comments before review

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@4928 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-02-12 15:18:05 +00:00
parent 3ab62f147e
commit 25fbf771a7
5 changed files with 208 additions and 194 deletions

View File

@ -40,6 +40,8 @@ typedef std::map<std::string, std::set<RsGxsSignedMessage*> > SignedMsgGrp;
/*! /*!
* The main role of GDP is the preparation and handing out of messages requested from * The main role of GDP is the preparation and handing out of messages requested from
* RsGeneralExchangeService and RsGeneralExchangeService * 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 * It also acts as a layer between RsGeneralStorageService and its parent RsGeneralExchangeService
* thus allowing for non-blocking requests, etc. * thus allowing for non-blocking requests, etc.
@ -49,6 +51,12 @@ typedef std::map<std::string, std::set<RsGxsSignedMessage*> > SignedMsgGrp;
* Caching feature: * Caching feature:
* - A cache index should be maintained which is faster than normal message request * - 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 * - 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.
*
*
*/ */
class RsGeneralDataService class RsGeneralDataService
{ {
@ -59,17 +67,17 @@ public:
* @param msgGrp this contains grp and the message to retrieve * @param msgGrp this contains grp and the message to retrieve
* @return request code to be redeemed later * @return request code to be redeemed later
*/ */
virtual int request(const MsgGrpId& msgGrp, SignedMsgGrp& result, bool decrypted) = 0; virtual int request(const MsgGrpId& msgGrp, bool decrypted) = 0;
/*! /*!
* allows for more complex queries specific to the service * allows for more complex queries specific to the service
* Service should implement method taking case * Service should implement its own specific filter
* @param filter generally stores parameters needed for query * @param filter generally stores parameters needed for query
* @param cacheRequest set to true to cache the messages requested * @param cacheRequest set to true to cache the messages requested
* @return request code to be redeemed later * @return request code to be redeemed later
*/ */
virtual int request(RequestFilter* filter, SignedMsgGrp& msgs, bool cacheRequest) = 0; virtual int request(RequestFilter* filter, bool cacheRequest) = 0;
/*! /*!
@ -79,13 +87,14 @@ public:
virtual bool store(SignedMsgGrp& msgs) = 0; virtual bool store(SignedMsgGrp& msgs) = 0;
/*! /*!
* @param grpIds set with grpIds available from storage * Gets group and any associated meta data
* @param grpIds set with group Ids available from storage
* @return request code to be redeemed later * @return request code to be redeemed later
*/ */
virtual int getGroups(std::set<std::string>& grpIds) = 0; virtual int getGroups(const std::set<std::string>& grpIds) = 0;
/*! /*!
* * Gets list of message ids in storage
* @param msgIds gets message ids in storage * @param msgIds gets message ids in storage
* @return request code to be redeemed later * @return request code to be redeemed later
*/ */

View File

@ -59,6 +59,11 @@
* 7) Data will be stored encrypted. * 7) Data will be stored encrypted.
*/ */
/*!
* Storage class for private and public publish keys
*
*/
class GixsKey class GixsKey
{ {
KeyRef mKeyId; KeyRef mKeyId;
@ -70,9 +75,13 @@
EVP_PKEY *mPrivKey; EVP_PKEY *mPrivKey;
}; };
/*!
*
*
*/
class KeyRef { class KeyRef {
std::string refId;
}; };
@ -85,21 +94,26 @@
std::set<Signature> mSignatureSet; std::set<Signature> mSignatureSet;
}; };
/*!
*
*
*/
class Signature { class Signature {
KeyRef mKeyRef; KeyRef mKeyRef;
Signature mSignature; Signature mSignature;
}; };
/*!
* This is the actual identity \n
* In a sense the group description with the GixsKey the "message"
*/
class RsGixsProfile { class RsGixsProfile {
public: public:
KeyRef mKeyRef; KeyRef mKeyRef;
std::string mPseudonym; std::string name;
/// may be superseded by newer timestamps /// may be superseded by newer timestamps
time_t mTimeStamp; time_t mTimeStamp;
@ -109,8 +123,6 @@
Signature mSignature; Signature mSignature;
}; };
/*! /*!
@ -118,7 +130,7 @@
* *
* Purpose: \n * Purpose: \n
* Provides a means to distribute identities among peers \n * Provides a means to distribute identities among peers \n
* also provides encyption, decryption, verification, \n * Also provides encyption, decryption, verification, \n
* and signing functionality using any created or received identities \n * and signing functionality using any created or received identities \n
* *
* This may best be implemented as a singleton like current AuthGPG? \n * This may best be implemented as a singleton like current AuthGPG? \n
@ -133,8 +145,9 @@
/*! /*!
* creates gixs profile and shares it * creates gixs profile and shares it
* @param profile * @param profile
* @param type the type of profile to create, self signed, anonymous, and GPG signed
*/ */
virtual bool createKey(RsGixsProfile& profile) = 0; /* fills in mKeyId, and signature */ virtual bool createKey(RsGixsProfile& profile, uint32_t type) = 0; /* fills in mKeyId, and signature */
/*! /*!
* Use to query a whether given key is available by its key reference * Use to query a whether given key is available by its key reference

View File

@ -34,7 +34,7 @@
#include <map> #include <map>
#include "gxs/rsgxs.h" #include "gxs/rsgxs.h"
#include "services/p3service.h"
/*! /*!
@ -75,75 +75,35 @@ typedef std::map<std::string, std::set<std::string> > PeerGrp;
/*! /*!
* Retroshare General Network Exchange Service: \n * Retroshare General Network Exchange Service: \n
* Interface: * Interface:
* - This provides a module to service peers requests for GXS message \n * - This provides a module to service peer's requests for GXS messages \n
* and also request GXS messages from other peers. \n * and also request GXS messages from other peers. \n
* - Users can make a general request for message under a grp id for a peer, all grp ids held \n * - The general mode of operation is to sychronise all messages/grps between
* by a set of peers. And can also apply to timerange to them * peers
* - An interface is provided for the observer pattern so clients of this class *
* can check if their requests have been served * The interface is sparse as this service is mostly making the requests to other GXS components
*
* Groups:
* - As this is where exchanges occur between peers, this is also where groups relationships
* should get resolved as far as
* - Per implemented GXS there are a set of rules which will determine whether data is transferred
* between any set of groups
*
* 1 allow transfers to any group
* 2 transfers only between group
* - the also group matrix settings which is by default everyone can transfer to each other
*/ */
class RsNetworktExchangeService class RsNetworktExchangeService : public p3Service
{ {
public: public:
RsNetworkExchangeService(); RsNetworkExchangeService(uint16_t subtype);
/*!
* Queries peers for a set of grp ids
* @param pg a map of peer to a set of grp ids to query message from
* @param from start range of time
* @param to end range of time
* @return a request code to be kept to redeem query later
*/
virtual int requestAvailableMsgs(PeerGrp& pg, time_t from, time_t to) = 0;
/*!
* Queries peer for msgs of peer grp id pairs
* @param pg peer, grp id peers
* @param from start range of time
* @param to end range of time
* @return a request code to be kept to redeem query later
*/
virtual int requestMsgs(PeerGrp& pg, time_t from, time_t to) = 0;
/*!
* Queries peers in list for groups avaialble
*
* @param peers the peers to query
* @param from start range of time
* @param to end range of time
* @return a request code to be kept to redeem query later
*/
int requestAvailableGrps(const std::set<std::string>& peers, time_t from, time_t to) = 0;
/*! /*!
* When messages are received this function should be call containing the messages * Use this to set how far back synchronisation of messages should take place
* @param msgs the messages received from peers * @param range how far back from current time to synchronise with other peers
*/ */
void messageFromPeers(std::list<RsGxsSignedMessage*>& msgs) = 0; virtual void setTimeRange(uint64_t range) = 0;
public:
/*!
* attempt to retrieve requested messages
* @param requestCode
* @param msgs
* @return false if not received, true is requestCode has been redeemed
* @see RsGeneralNetExchangeService::requestAvailableGrps()
*/
bool getRequested(uint32_t requestCode, std::list<RsGxsSignedMessage*>& msgs) = 0;
/*!
* Allows observer pattern for checking if a request has been satisfied
*
* @param requestCode the code returned msg request functions
* @return false if not ready, true otherwise
* @see RsGeneralNetExchangeService::requestAvailableGrps()
* @see RsGeneralNetExchangeService::requestAvailableMsgs()
*/
bool requestCodeReady(uint32_t reuqestCode);
}; };

View File

@ -38,6 +38,9 @@
// Relay connexions: // Relay connexions:
// * allow relay connexions between people of group A and group B. // * allow relay connexions between people of group A and group B.
// //
// General Exchange Services:
// * Allow data exchanged from one peers of one group to peers of another group
//
// We need per-group permission flags for: // We need per-group permission flags for:
// //
// File download permission: // File download permission:

View File

@ -33,12 +33,16 @@
#include <string> #include <string>
#include <inttypes.h> #include <inttypes.h>
#include <map>
#include "serialiser/rsbaseitems.h" #include "serialiser/rsbaseitems.h"
#include "rsgnp.h" #include "rsgnp.h"
#include "rsgdp.h" #include "rsgdp.h"
#include "rsgixs.h" #include "rsgixs.h"
typedef std::map<uint32_t, std::string> requestMsgMap;
/*! /*!
* *
* Brief explanation of how RsGeneralExchange service would work \n * Brief explanation of how RsGeneralExchange service would work \n
@ -82,18 +86,43 @@ public:
/*! /*!
* get the RsGeneralDataService instance serving this \n * get the RsGeneralDataService instance serving this \n
* RsGeneralExchangeService * @see RsGeneralExchangeService
* @return data service * @return data service
*/ */
virtual RsGeneralDataService* getDataService() = 0; virtual RsGeneralDataService* getDataService() = 0;
/*! /*!
* get the RsNetworktExchangeService instance serving this \n * get the RsNetworktExchangeService instance serving this \n
* RsGeneralExchangeService * @see RsGeneralExchangeService
* @return network exchange service * @return network exchange service
*/ */
virtual RsNetworktExchangeService* getNetworkService() = 0; virtual RsNetworktExchangeService* getNetworkService() = 0;
/*!
* Requests by this service for messages can be satisfied calling \n
* this method with a map containing id to msg map
*/
virtual void receiveMessages(requestMsgMap&) = 0;
/*!
* This allows non blocking requests to be made to this service
*/
virtual void tick();
};
/*!
* Implementations of general exchange service can be added \n
* to this service runner which ticks the service's general data service \n
* and the service itself
*/
class RsGxServiceRunner : public RsThread {
public:
virtual void addGxService() = 0;
}; };