mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 08:59:37 -05:00
added record for H(H(F)) in LocalDirectoryStorage
This commit is contained in:
parent
d843c1c1a6
commit
9a881619e1
@ -289,6 +289,10 @@ bool DirectoryStorage::getIndexFromDirHash(const RsFileHash& hash,EntryIndex& in
|
||||
/* Local Directory Storage */
|
||||
/******************************************************************************************************************/
|
||||
|
||||
RsFileHash LocalDirectoryStorage::makeEncryptedHash(const RsFileHash& hash)
|
||||
{
|
||||
return RsDirUtil::sha1sum(hash.toByteArray(),hash.SIZE_IN_BYTES);
|
||||
}
|
||||
bool LocalDirectoryStorage::locked_findRealHash(const RsFileHash& hash, RsFileHash& real_hash) const
|
||||
{
|
||||
std::map<RsFileHash,RsFileHash>::const_iterator it = mEncryptedHashes.find(hash) ;
|
||||
@ -454,7 +458,15 @@ void LocalDirectoryStorage::updateTimeStamps()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
bool LocalDirectoryStorage::updateHash(const EntryIndex& index,const RsFileHash& hash)
|
||||
{
|
||||
{
|
||||
RS_STACK_MUTEX(mDirStorageMtx) ;
|
||||
|
||||
mEncryptedHashes[makeEncryptedHash(hash)] = hash ;
|
||||
}
|
||||
return mFileHierarchy->updateHash(index,hash);
|
||||
}
|
||||
std::string LocalDirectoryStorage::locked_findRealRootFromVirtualFilename(const std::string& virtual_rootdir) const
|
||||
{
|
||||
/**** MUST ALREADY BE LOCKED ****/
|
||||
|
@ -139,7 +139,9 @@ class DirectoryStorage
|
||||
// Updates relevant information for the file at the given index.
|
||||
|
||||
bool updateFile(const EntryIndex& index,const RsFileHash& hash, const std::string& fname, uint64_t size, time_t modf_time) ;
|
||||
bool updateHash(const EntryIndex& index,const RsFileHash& hash);
|
||||
|
||||
// This is derived in LocalDirectoryStorage in order to also store H(H(F))
|
||||
virtual bool updateHash(const EntryIndex& index,const RsFileHash& hash);
|
||||
|
||||
// Returns the hash of the directory at the given index and reverse. This hash is set as random the first time it is used (when updating directories). It will be
|
||||
// used by the sync system to designate the directory without referring to index (index could be used to figure out the existance of hidden directories)
|
||||
@ -215,6 +217,7 @@ public:
|
||||
void updateShareFlags(const SharedDirInfo& info) ;
|
||||
bool convertSharedFilePath(const std::string& path_with_virtual_name,std::string& fullpath) ;
|
||||
|
||||
virtual bool updateHash(const EntryIndex& index,const RsFileHash& hash);
|
||||
/*!
|
||||
* \brief searchHash
|
||||
* Looks into local database of shared files for the given hash. Also looks for files such that the hash of the hash
|
||||
@ -273,6 +276,7 @@ public:
|
||||
bool serialiseDirEntry(const EntryIndex& indx, RsTlvBinaryData& bindata, const RsPeerId &client_id) ;
|
||||
|
||||
private:
|
||||
static RsFileHash makeEncryptedHash(const RsFileHash& hash);
|
||||
bool locked_findRealHash(const RsFileHash& hash, RsFileHash& real_hash) const;
|
||||
std::string locked_getVirtualPath(EntryIndex indx) const ;
|
||||
std::string locked_getVirtualDirName(EntryIndex indx) const ;
|
||||
|
Loading…
Reference in New Issue
Block a user