2007-11-14 22:18:48 -05:00
|
|
|
/*
|
|
|
|
* RetroShare FileCache Module: fistore.h
|
2009-08-25 16:49:50 -04:00
|
|
|
*
|
2007-11-14 22:18:48 -05:00
|
|
|
* Copyright 2004-2007 by Robert Fernie.
|
2009-08-25 16:49:50 -04:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2007-11-14 22:18:48 -05:00
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
2009-08-25 16:49:50 -04:00
|
|
|
* 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.
|
2007-11-14 22:18:48 -05:00
|
|
|
*
|
|
|
|
* 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".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MRK_FILE_INDEX_STORE_H
|
|
|
|
#define MRK_FILE_INDEX_STORE_H
|
|
|
|
|
|
|
|
|
|
|
|
/**********
|
|
|
|
* Stores the FileCaches of the Peers
|
2009-08-25 16:49:50 -04:00
|
|
|
* must implement 'loadCache' to
|
2007-11-14 22:18:48 -05:00
|
|
|
*
|
|
|
|
* This class is also accessed by the GUI....
|
|
|
|
* and the FileTransfer class.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-07-09 14:39:34 -04:00
|
|
|
class p3PeerMgr ;
|
2010-06-05 15:16:39 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include "dbase/findex.h"
|
|
|
|
#include "dbase/cachestrapper.h"
|
2010-08-06 05:40:23 -04:00
|
|
|
#include "retroshare/rsiface.h"
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
class FileStoreResult
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string id;
|
|
|
|
std::string path;
|
|
|
|
std::string hash;
|
|
|
|
std::string name;
|
|
|
|
};
|
|
|
|
|
|
|
|
class NotifyCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NotifyCallback() { return; }
|
|
|
|
virtual ~NotifyCallback() { return; }
|
|
|
|
virtual void AboutToModify() { return; }
|
|
|
|
virtual void ModCompleted() { return; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Expression;
|
|
|
|
|
|
|
|
class FileIndexStore: public CacheStore
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-07-09 14:39:34 -04:00
|
|
|
FileIndexStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3PeerMgr *pmgr, RsPeerId ownid, std::string cachedir);
|
2007-11-14 22:18:48 -05:00
|
|
|
virtual ~FileIndexStore();
|
|
|
|
|
|
|
|
/* virtual functions overloaded by cache implementor */
|
2013-10-21 08:07:33 -04:00
|
|
|
virtual int loadCache(const RsCacheData &data); /* actual load, once data available */
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
/* Search Interface - For FileTransfer Lookup */
|
2008-08-09 12:06:01 -04:00
|
|
|
int SearchHash(std::string hash, std::list<FileDetail> &results) const;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
/* Search Interface - For Search Interface */
|
2012-11-02 09:52:29 -04:00
|
|
|
int SearchKeywords(std::list<std::string> terms, std::list<DirDetails> &results,FileSearchFlags flags) const;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
/* Search Interface - for Adv Search Interface */
|
2009-08-25 16:49:50 -04:00
|
|
|
int searchBoolExp(Expression * exp, std::list<DirDetails> &results) const;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
/* Search Interface - For Directory Access */
|
2012-01-17 15:38:25 -05:00
|
|
|
int RequestDirDetails(const std::string& uid, const std::string& path, DirDetails &details) const;
|
2012-11-02 09:52:29 -04:00
|
|
|
int RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags) const;
|
2011-04-03 15:59:12 -04:00
|
|
|
uint32_t getType(void *ref) const ;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
int AboutToModify();
|
|
|
|
int ModCompleted();
|
|
|
|
|
|
|
|
std::map<RsPeerId, FileIndex *> indices;
|
|
|
|
|
|
|
|
RsPeerId localId;
|
|
|
|
FileIndex *localindex;
|
|
|
|
|
|
|
|
NotifyBase *cb;
|
2011-07-09 14:39:34 -04:00
|
|
|
p3PeerMgr *mPeerMgr ;
|
2007-11-14 22:18:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|