mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-08 00:55:13 -04:00
added interface for p3FileLists
This commit is contained in:
parent
8e2ff56f9a
commit
a6d467d138
2 changed files with 140 additions and 10 deletions
|
@ -19,11 +19,68 @@
|
|||
// The file lists are not directry updated. A FileListWatcher class is responsible for this
|
||||
// in every case.
|
||||
//
|
||||
class p3FileLists: public p3Service
|
||||
#include <services/p3service.h>
|
||||
#include <pqi/p3cfgmgr.h>
|
||||
|
||||
class p3FileLists: public p3Service, public p3Config, public RsSharedFileService
|
||||
{
|
||||
public:
|
||||
p3FileLists() ;
|
||||
typedef uint64_t EntryIndex ; // this should probably be defined elsewhere
|
||||
|
||||
p3FileLists(mPeerMgr *mpeers) ;
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
// derived from p3Service
|
||||
//
|
||||
virtual int tick() ;
|
||||
|
||||
// access to own/remote shared files
|
||||
//
|
||||
virtual bool findLocalFile(const RsFileHash& hash,FileSearchFlags flags,const RsPeerId& peer_id, std::string &fullpath, uint64_t &size,FileStorageFlags& storage_flags,std::list<std::string>& parent_groups) const;
|
||||
|
||||
virtual int SearchKeywords(const std::list<std::string>& keywords, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) ;
|
||||
virtual int SearchBoolExp(Expression *exp, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const ;
|
||||
|
||||
// Interface for browsing dir hierarchy
|
||||
//
|
||||
int RequestDirDetails(EntryIndex, DirDetails&, FileSearchFlags) const ;
|
||||
uint32_t getType(const EntryIndex&) const ;
|
||||
int RequestDirDetails(const std::string& path, DirDetails &details) const ;
|
||||
|
||||
// set/update shared directories
|
||||
void setSharedDirectories(const std::list<SharedDirInfo>& dirs);
|
||||
void getSharedDirectories(std::list<SharedDirInfo>& dirs);
|
||||
void updateShareFlags(const SharedDirInfo& info) ;
|
||||
|
||||
void forceDirectoryCheck(); // Force re-sweep the directories and see what's changed
|
||||
bool inDirectoryCheck();
|
||||
|
||||
// Derived from p3Config
|
||||
//
|
||||
private:
|
||||
p3PeerMgr *mPeers ;
|
||||
|
||||
// File sync request queues. The fast one is used for online browsing when friends are connected.
|
||||
// The slow one is used for background update of file lists.
|
||||
//
|
||||
std::list<RsFileListSyncRequest> mFastRequestQueue ;
|
||||
std::list<RsFileListSyncRequest> mSlowRequestQueue ;
|
||||
|
||||
// Directory storage hierarchies
|
||||
//
|
||||
std::map<RsPeerId,RemoteDirectoryStorage *> mRemoteDirectories ;
|
||||
|
||||
LocalSharedDirectoryMap *mLocalSharedDirs ;
|
||||
|
||||
RemoteSharedDirectoryWatcher *mRemoteDirWatcher ;
|
||||
LocalSharedDirectoryWatcher *mLocalDirWatcher ;
|
||||
|
||||
// We use a shared file cache as well, to avoid re-hashing files with known modification TS and equal name.
|
||||
//
|
||||
HashCache *mHashCache ;
|
||||
|
||||
RsMutex mFLSMtx ;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue