mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
checked in first bits of code for cache service data optimisation,
distrib can build grps xml document added pugixml src code into utilities pls see design document: http://retroshare.sourceforge.net/wiki/index.php/Documentation:design_services_histories git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4076 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
976aadc1b3
commit
ec0ce30103
8 changed files with 10906 additions and 2 deletions
|
@ -259,6 +259,21 @@ bool CacheStore::getStoredCache(CacheData &data)
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool CacheStore::cached(const std::string cacheId)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CacheStore::updateCacheDocument(pugi::xml_document& cacheDoc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void CacheStore::updateCacheTable()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool CacheStore::locked_getStoredCache(CacheData &data)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "pqi/p3cfgmgr.h"
|
||||
#include "pqi/pqimonitor.h"
|
||||
#include "util/rsthreads.h"
|
||||
#include "util/pugixml.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
@ -217,6 +218,7 @@ class CacheSource
|
|||
|
||||
/*!
|
||||
* Base Class for data cache. eg. FileCache/Store.
|
||||
* This is best used to deal with external caches from other peers
|
||||
* @see p3Distrib. pqiMonitor
|
||||
*/
|
||||
class CacheStore
|
||||
|
@ -313,7 +315,33 @@ class CacheStore
|
|||
*/
|
||||
bool locked_getStoredCache(CacheData &data);
|
||||
|
||||
|
||||
//////////////// Cache Optimisation //////////////////
|
||||
|
||||
/**
|
||||
*@param id the key for determing whether this data has been cached or not
|
||||
*@return true if data referenced by key has been cached false otherwise
|
||||
*/
|
||||
bool cached(const std::string cacheId);
|
||||
|
||||
/**
|
||||
* TODO: will be abstract
|
||||
* The deriving class should return a document which accurately reflects its data
|
||||
* structure
|
||||
* @param cacheDoc document reflecting derving class's cache data structure
|
||||
*/
|
||||
virtual void updateCacheDocument(pugi::xml_document& cacheDoc);
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////// Cache Optimisation //////////////////
|
||||
private:
|
||||
/**
|
||||
* This updates the cache table with information from the xml document
|
||||
*
|
||||
*/
|
||||
void updateCacheTable();
|
||||
|
||||
uint16_t cacheType; /* for checking */
|
||||
bool multiCache; /* do we care about subid's */
|
||||
|
@ -324,9 +352,16 @@ class CacheStore
|
|||
std::string cacheDir;
|
||||
|
||||
mutable RsMutex cMutex;
|
||||
|
||||
std::map<RsPeerId, CacheSet> caches;
|
||||
|
||||
////////////// cache optimisation ////////////////
|
||||
|
||||
/// whether to run in cache optimisation mode
|
||||
bool cacheOptMode;
|
||||
|
||||
/// stores whether given instance of cache data has been loaded already or not
|
||||
std::map<std::string, bool> cacheTable;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue