aboutsummaryrefslogtreecommitdiff
path: root/zenstore/cidstore.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-11-01 20:00:04 +0100
committerStefan Boberg <[email protected]>2021-11-01 20:00:04 +0100
commite64410bfcc85add1a5caa8309cde2aaa5e15baa0 (patch)
treea61a203c35179dd8175a9c5d0db3fcd5d2f725e6 /zenstore/cidstore.cpp
parentprojectstore: Implemented project/oplog discovery so we can take any persiste... (diff)
downloadzen-e64410bfcc85add1a5caa8309cde2aaa5e15baa0.tar.xz
zen-e64410bfcc85add1a5caa8309cde2aaa5e15baa0.zip
cid: Added RemapCid() for use in GC
Diffstat (limited to 'zenstore/cidstore.cpp')
-rw-r--r--zenstore/cidstore.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/zenstore/cidstore.cpp b/zenstore/cidstore.cpp
index eaad0f5a8..c91f69ff7 100644
--- a/zenstore/cidstore.cpp
+++ b/zenstore/cidstore.cpp
@@ -73,6 +73,17 @@ struct CidStore::Impl
m_LogFile.Append({.Uncompressed = DecompressedId, .Compressed = CompressedHash});
}
+ IoHash RemapCid(const IoHash& DecompressedId)
+ {
+ RwLock::SharedLockScope _(m_Lock);
+ if (auto It = m_CidMap.find(DecompressedId); It != m_CidMap.end())
+ {
+ return It->second;
+ }
+
+ return IoHash::Zero;
+ }
+
IoBuffer FindChunkByCid(const IoHash& DecompressedId)
{
IoHash CompressedHash;
@@ -254,6 +265,12 @@ CidStore::FindChunkByCid(const IoHash& DecompressedId)
return m_Impl->FindChunkByCid(DecompressedId);
}
+IoHash
+CidStore::RemapCid(const IoHash& DecompressedId)
+{
+ return m_Impl->RemapCid(DecompressedId);
+}
+
bool
CidStore::ContainsChunk(const IoHash& DecompressedId)
{