From 2f6061c8acdcbc9d98f6f80070e798d6c84eaa2c Mon Sep 17 00:00:00 2001 From: drbob Date: Tue, 14 Feb 2012 15:33:58 +0000 Subject: [PATCH] added example of what the basic service should look like. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@4939 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/gxs/db_gxp_service.h | 104 +++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 libretroshare/src/gxs/db_gxp_service.h diff --git a/libretroshare/src/gxs/db_gxp_service.h b/libretroshare/src/gxs/db_gxp_service.h new file mode 100644 index 000000000..2d22becbb --- /dev/null +++ b/libretroshare/src/gxs/db_gxp_service.h @@ -0,0 +1,104 @@ + +/* Generalised Service Base Class. + * The base class interfaces with gixp, disk, net services. + */ + +class RsGxpLink +{ + uint32_t type; + std::string msgId; +} + +class RsGxpItem +{ + std::string msgId; + std::string origMsgId; + std::string groupId; + gxpTime time; + std::list hashtags; + std::list linked; + + gxpsignature sign; +}; + +class RsGxpGroup +{ + + + +}; + +class gxp_service +{ + public: + + requestItem(msgId); + + recv(RsGxpItem *item); + send(RsGxpItem *item); + + /****************************************************************************************************/ + // Event Callback for the service. + /****************************************************************************************************/ + + notify_groupChanged(); // Mainly for GUI display. + notify_newMessage(); // used for newsFeeds. + notify_duplicateMessage(); // Channels needs this for Downloading stuff, can probably be moved above. + locked_checkDistribMsg(); // required overload? + /****************************************************************************************************/ + // Must worry about sharing keys. + // Can gixp handle it? + // What interfaces do we need here? + /****************************************************************************************************/ + + /****************************************************************************************************/ + // Interface for Message Read Status + // At the moment this is overloaded to handle autodownload flags too. + // This is a configuration thing. + /****************************************************************************************************/ + + int flagItemRead(std::string id); + int flagItemUnread(std::string id); + int flagGroupRead(std::string id); + int flagGroupUnread(std::string id); + + /****************************************************************************************************/ + // External Interface for Data. + /****************************************************************************************************/ + + // Mesage Creation. + int createGroup(RsGxpGroup *grp); + int createItem(RsGxpItem *item); + + // Group Lists & Message Lists. + int getGroupsChanged(std::list &groupIds); + int getGroups(std::list &groupIds); + int getGroupList(std::string grpId, std::list &groupIds); + int getTimeRange(GxpTime from, GxpTime to, std::list &msgIds); + int getGroupTimeRange(std::string grpId, GxpTime from, GxpTime to, std::list &msgIds); + int getReplacementMsgs(std::string origId, std::list replaceIds); + + // Getting the Actual Data. + int haveItem(std::string msgId); + int requestItem(std::string msgId); + RsGxpItem *getMsg_locked(std::string msgId); + RsGxpGroup *getGroup_locked(std::string msgId); + + // Interface with GIXP Stuff... everything else should be behind the scenes. + RsGixpProfile *getProfile_locked(std::string id); + + // Immediate Search... + int searchReferringLinks(RsGxpLink link, std::list &msgIds); + int searchHashTags(std::list, std::list &msgIds); + + // Remote Search... + + private: + + // Reversed Index: for hash searching. + std::map > mSearchMap; +}; + + + +