From cf5158d2b0adaa74325416040a2d88ba31046bd2 Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Mon, 16 Jan 2012 21:52:22 +0000 Subject: [PATCH] added new declaration for retrodb and removed sqlite reference. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@4804 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/gxs/rsgnp.h | 14 +++---- libretroshare/src/gxs/rsgxs.h | 40 ++++++++++++++----- libretroshare/src/libretroshare.pro | 4 +- .../src/util/{rssqlite.cpp => retrodb.cpp} | 0 .../src/util/{rssqlite.h => retrodb.h} | 4 +- 5 files changed, 40 insertions(+), 22 deletions(-) rename libretroshare/src/util/{rssqlite.cpp => retrodb.cpp} (100%) rename libretroshare/src/util/{rssqlite.h => retrodb.h} (93%) diff --git a/libretroshare/src/gxs/rsgnp.h b/libretroshare/src/gxs/rsgnp.h index 3c649bc4e..2b2c80408 100644 --- a/libretroshare/src/gxs/rsgnp.h +++ b/libretroshare/src/gxs/rsgnp.h @@ -2,6 +2,8 @@ #define RSGNP_H #include +#include +#include #include "services/p3service.h" #include "gxs/rsgdp.h" @@ -22,21 +24,17 @@ public: /*** gdp::iterface *****/ int requestMsgs(std::set msgId, double &delay); - void addGdp(RsGdp* gdp); - void removeGdp(RsGdp* gdp); + void addGdp(RsGdp* gdp) = 0; + void removeGdp(RsGdp* gdp) = 0; -private: +public: /*** IMPLEMENTATION DETAILS ****/ /* Get/Send Messages */ void getAvailableMsgs(std::string peerId, time_t from, time_t to); /* request over the network */ - void sendAvailableMsgs(std::string peerId, gdp::id grpId, time_t from, time_t to); /* send to peers */ + void sendAvailableMsgs(std::string peerId, time_t from, time_t to); /* send to peers */ - requestMessages(std::string peerId, gdp::id grpId, std::list msgIds); - sendMessages(std::string peerId, gdp::id grpId, std::list msgIds); /* send to peer, obviously permissions have been checked first */ - - /* Search the network */ }; #endif // RSGNP_H diff --git a/libretroshare/src/gxs/rsgxs.h b/libretroshare/src/gxs/rsgxs.h index c51b71e4d..3b3ca5aff 100644 --- a/libretroshare/src/gxs/rsgxs.h +++ b/libretroshare/src/gxs/rsgxs.h @@ -31,6 +31,7 @@ */ #include "rsgdp.h" +#include "util/rsthreads.h" /*! * Retroshare general exchange service @@ -40,11 +41,14 @@ * GDP deals with exporting and importing msgs to and from the concrete service * data from the derived class * GXIP is used to maintain + * + * + * The maiin transport mechanism */ -class RsGxs +class RsGxs : public RsThread { public: - RsGxs(); + RsGxs(const std::string& serviceName); public: @@ -52,27 +56,43 @@ public: * These are messages, that have been pushed to you * This will be called by RsGdp whenever a new msg(s) has arrived * the list contains ids which may be queried from the external db + * + * @param msgIds the ids of the new msgs received */ - virtual void receiveMessage(std::set msgIds) = 0; + virtual void receiveMessage(std::set& msgIds) = 0; /*! * Push a set of messages which have been written to your service * database + * @param msgIds */ void push(std::set& msgIds) = 0; - /*! - * drives synchronisation between peers - */ - void tick(); - void cache(RsGxsSignedMessage*); + /*! + * allows for non blocking pushes, receives, and configuration changes. + */ + void run(); + + + /*! + * cache a message + * @param msg message to cache + * + */ + void cache(RsGxsSignedMessage* msg); + + /*! + * Queries if message with message id is cached + * @param msgId the id of the message to query + */ bool cached(std::string& msgId); /*! * Use to retrieve cached msgs - * - * @param msgs the cached msgs + * If message id of messages not cached are requested, it is simply ignored + * @param requestIds The ids of messages to retrieve + * @param msgs the retrieved cached messages */ void retrieveCache(std::set& requestIds, std::set& msgs); diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index bd6a3de70..a0e833b0c 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -163,7 +163,7 @@ HEADERS += plugins/pluginmanager.h \ gxs/rsgxs.h \ gxs/rsgnp.h \ gxs/rsgdp.h \ - util/rssqlite.h \ + util/retrodb.h \ gxs/rsgixs.h HEADERS += $$PUBLIC_HEADERS @@ -668,7 +668,7 @@ SOURCES += \ gxs/rsgdp.cpp SOURCES += \ - util/rssqlite.cpp + util/retrodb.cpp SOURCES += \ gxs/rsgixs.cpp diff --git a/libretroshare/src/util/rssqlite.cpp b/libretroshare/src/util/retrodb.cpp similarity index 100% rename from libretroshare/src/util/rssqlite.cpp rename to libretroshare/src/util/retrodb.cpp diff --git a/libretroshare/src/util/rssqlite.h b/libretroshare/src/util/retrodb.h similarity index 93% rename from libretroshare/src/util/rssqlite.h rename to libretroshare/src/util/retrodb.h index 28b05f9ee..f35c479d7 100644 --- a/libretroshare/src/util/rssqlite.h +++ b/libretroshare/src/util/retrodb.h @@ -7,8 +7,8 @@ #include /*! - * The idea of RsDb is to provide a means for Retroshare core and its services itself to maintain - * easy to use random access files via a database + * The idea of RsDb is to provide a means for Retroshare core and + * its services itself to maintain easy to use random access files via a database * Especially for messages, rather than all data to memory * It models itself after android's sqlite functionality */