aboutsummaryrefslogtreecommitdiff
path: root/zenstore/filecas.h
diff options
context:
space:
mode:
Diffstat (limited to 'zenstore/filecas.h')
-rw-r--r--zenstore/filecas.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/zenstore/filecas.h b/zenstore/filecas.h
index 18102968a..2e09367df 100644
--- a/zenstore/filecas.h
+++ b/zenstore/filecas.h
@@ -12,6 +12,10 @@
#include <functional>
+namespace spdlog {
+class logger;
+}
+
namespace zen {
class BasicFile;
@@ -37,10 +41,21 @@ private:
const CasStoreConfiguration& m_Config;
RwLock m_Lock;
RwLock m_ShardLocks[256]; // TODO: these should be spaced out so they don't share cache lines
+ spdlog::logger& m_Log;
+ spdlog::logger& Log() { return m_Log; }
inline RwLock& LockForHash(const IoHash& Hash) { return m_ShardLocks[Hash.Hash[19]]; }
static WideStringBuilderBase& MakeShardedPath(WideStringBuilderBase& ShardedPath, const IoHash& ChunkHash, size_t& OutShard2len);
void IterateChunks(std::function<void(const IoHash& Hash, BasicFile& PayloadFile)>&& Callback);
+ void DeleteChunk(const IoHash& ChunkHash, std::error_code& Ec);
+
+ struct ShardingHelper
+ {
+ ShardingHelper(const std::filesystem::path& RootPath, const IoHash& ChunkHash);
+
+ size_t Shard2len = 0;
+ ExtendableWideStringBuilder<128> ShardedPath;
+ };
};
} // namespace zen