diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-02 16:53:21 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-05-02 16:53:21 +0200 |
| commit | ae8505ad0af6375289c83b6455796e0c91609dc9 (patch) | |
| tree | 2cc89875827523298c12b8aa7eb1b5329081d43c /zenstore | |
| parent | simplify lambda captures (diff) | |
| download | zen-ae8505ad0af6375289c83b6455796e0c91609dc9.tar.xz zen-ae8505ad0af6375289c83b6455796e0c91609dc9.zip | |
Make sure we close all block files when dropping a cache bucket
Diffstat (limited to 'zenstore')
| -rw-r--r-- | zenstore/blockstore.cpp | 11 | ||||
| -rw-r--r-- | zenstore/include/zenstore/blockstore.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/zenstore/blockstore.cpp b/zenstore/blockstore.cpp index e502113fc..b82b93823 100644 --- a/zenstore/blockstore.cpp +++ b/zenstore/blockstore.cpp @@ -193,6 +193,17 @@ BlockStore::Initialize(const std::filesystem::path& BlocksBasePath, } } +void +BlockStore::Close() +{ + RwLock::ExclusiveLockScope InsertLock(m_InsertLock); + m_WriteBlock = nullptr; + m_CurrentInsertOffset = 0; + m_WriteBlockIndex = 0; + m_ChunkBlocks.clear(); + m_BlocksBasePath.clear(); +} + BlockStoreLocation BlockStore::WriteChunk(const void* Data, uint64_t Size, uint64_t Alignment) { diff --git a/zenstore/include/zenstore/blockstore.h b/zenstore/include/zenstore/blockstore.h index 5019e257d..e153b530e 100644 --- a/zenstore/include/zenstore/blockstore.h +++ b/zenstore/include/zenstore/blockstore.h @@ -131,6 +131,7 @@ public: uint64_t MaxBlockSize, uint64_t MaxBlockCount, const std::vector<BlockStoreLocation>& KnownLocations); + void Close(); BlockStoreLocation WriteChunk(const void* Data, uint64_t Size, uint64_t Alignment); |