diff options
| author | Stefan Boberg <[email protected]> | 2023-06-30 12:07:36 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2023-06-30 12:07:36 +0200 |
| commit | 080c9f8b25cb0e65616286524de2f2aca6f1a77d (patch) | |
| tree | 711c10114111caed0d7604a93a0e254034534d40 /src | |
| parent | clang-format :( (diff) | |
| download | zen-080c9f8b25cb0e65616286524de2f2aca6f1a77d.tar.xz zen-080c9f8b25cb0e65616286524de2f2aca6f1a77d.zip | |
CidStore now implements the ChunkResolver interface
this allows client code to use the ChunkResolver interface instead of
CidStore, which can help with testing scenarios
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenstore/blockstore.cpp | 12 | ||||
| -rw-r--r-- | src/zenstore/include/zenstore/blockstore.h | 3 | ||||
| -rw-r--r-- | src/zenstore/include/zenstore/cidstore.h | 18 | ||||
| -rw-r--r-- | src/zenstore/xmake.lua | 1 |
4 files changed, 21 insertions, 13 deletions
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index e0876070b..997774ebe 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -80,10 +80,6 @@ BlockStoreFile::MarkAsDeleteOnClose() IoBuffer BlockStoreFile::GetChunk(uint64_t Offset, uint64_t Size) { - if ((Offset + Size) > m_IoBuffer.GetSize()) - { - return IoBuffer(); - } return IoBuffer(m_IoBuffer, Offset, Size); } @@ -119,6 +115,14 @@ BlockStoreFile::StreamByteRange(uint64_t FileOffset, uint64_t Size, std::functio constexpr uint64_t ScrubSmallChunkWindowSize = 4 * 1024 * 1024; +BlockStore::BlockStore() +{ +} + +BlockStore::~BlockStore() +{ +} + std::unordered_map<uint32_t, uint64_t> BlockStore::Initialize(const std::filesystem::path& BlocksBasePath, uint64_t MaxBlockSize, uint64_t MaxBlockCount) { diff --git a/src/zenstore/include/zenstore/blockstore.h b/src/zenstore/include/zenstore/blockstore.h index a8bd44b9b..edd6df5a2 100644 --- a/src/zenstore/include/zenstore/blockstore.h +++ b/src/zenstore/include/zenstore/blockstore.h @@ -111,6 +111,9 @@ private: class BlockStore { public: + BlockStore(); + ~BlockStore(); + struct ReclaimSnapshotState { std::unordered_set<uint32_t> m_ActiveWriteBlocks; diff --git a/src/zenstore/include/zenstore/cidstore.h b/src/zenstore/include/zenstore/cidstore.h index 79f906307..38815ed15 100644 --- a/src/zenstore/include/zenstore/cidstore.h +++ b/src/zenstore/include/zenstore/cidstore.h @@ -21,14 +21,6 @@ class CompressedBuffer; class IoBuffer; class ScrubContext; -/** Content Store - * - * Data in the content store is referenced by content identifiers (CIDs), it works - * with compressed buffers so the CID is expected to be the RAW hash. It stores the - * chunk directly under the RAW hash. - * - */ - struct CidStoreSize { uint64_t TinySize = 0; @@ -49,7 +41,15 @@ struct CidStoreConfiguration uint64_t HugeValueThreshold = 1024 * 1024; }; -class CidStore +/** Content Store + * + * Data in the content store is referenced by content identifiers (CIDs), it works + * with compressed buffers so the CID is expected to be the RAW hash. It stores the + * chunk directly under the RAW hash. + * + */ + +class CidStore final : public ChunkResolver { public: CidStore(GcManager& Gc); diff --git a/src/zenstore/xmake.lua b/src/zenstore/xmake.lua index 4469c5650..f0bd64d2e 100644 --- a/src/zenstore/xmake.lua +++ b/src/zenstore/xmake.lua @@ -2,6 +2,7 @@ target('zenstore') set_kind("static") + set_group("libs") add_headerfiles("**.h") add_files("**.cpp") add_includedirs("include", {public=true}) |