aboutsummaryrefslogtreecommitdiff
path: root/zenstore/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-05-02 16:41:32 +0200
committerDan Engelbrecht <[email protected]>2022-05-02 16:41:32 +0200
commitbb7593c9ea3412a48b3d29f3e7f7b23d7a785b2f (patch)
tree133f4ada4cce17ca808ec65249aab7f2d2a83ae1 /zenstore/include
parentMerge branch 'de/block-store-refactor' of github.com:EpicGames/zen into de/bl... (diff)
downloadzen-bb7593c9ea3412a48b3d29f3e7f7b23d7a785b2f.tar.xz
zen-bb7593c9ea3412a48b3d29f3e7f7b23d7a785b2f.zip
Refactor WriteChunk to not need callback
Diffstat (limited to 'zenstore/include')
-rw-r--r--zenstore/include/zenstore/blockstore.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/zenstore/include/zenstore/blockstore.h b/zenstore/include/zenstore/blockstore.h
index 4a1642413..5019e257d 100644
--- a/zenstore/include/zenstore/blockstore.h
+++ b/zenstore/include/zenstore/blockstore.h
@@ -114,8 +114,8 @@ class BlockStore
public:
struct ReclaimSnapshotState
{
- std::unordered_set<uint32_t> ExcludeBlockIndexes;
- size_t BlockCount;
+ size_t ExcludeBlockIndex;
+ size_t BlockCount;
};
typedef std::vector<std::pair<size_t, BlockStoreLocation>> MovedChunksArray;
@@ -123,7 +123,6 @@ public:
typedef std::function<void(const MovedChunksArray& MovedChunks, const ChunkIndexArray& RemovedChunks)> ReclaimCallback;
typedef std::function<uint64_t()> ClaimDiskReserveCallback;
- typedef std::function<void(const BlockStoreLocation& Location)> WriteChunkCallback;
typedef std::function<void(size_t ChunkIndex, const void* Data, uint64_t Size)> IterateChunksSmallSizeCallback;
typedef std::function<void(size_t ChunkIndex, BasicFile& BlockFile, uint64_t Offset, uint64_t Size)> IterateChunksLargeSizeCallback;
typedef std::function<void(const MovedChunksArray& MovedChunks)> SplitCallback;
@@ -133,11 +132,7 @@ public:
uint64_t MaxBlockCount,
const std::vector<BlockStoreLocation>& KnownLocations);
- void WriteChunk(
- const void* Data,
- uint64_t Size,
- uint64_t Alignment,
- WriteChunkCallback Callback = [](const BlockStoreLocation&) {});
+ BlockStoreLocation WriteChunk(const void* Data, uint64_t Size, uint64_t Alignment);
Ref<BlockStoreFile> GetChunkBlock(const BlockStoreLocation& Location);
void Flush();
@@ -171,11 +166,10 @@ public:
private:
std::unordered_map<uint32_t, Ref<BlockStoreFile>> m_ChunkBlocks;
- RwLock m_InsertLock; // used to serialize inserts
- Ref<BlockStoreFile> m_WriteBlock;
- std::uint64_t m_CurrentInsertOffset = 0;
- std::atomic_uint32_t m_WriteBlockIndex{};
- std::vector<uint32_t> m_ActiveWriteBlockIndexes;
+ RwLock m_InsertLock; // used to serialize inserts
+ Ref<BlockStoreFile> m_WriteBlock;
+ std::uint64_t m_CurrentInsertOffset = 0;
+ std::atomic_uint32_t m_WriteBlockIndex{};
uint64_t m_MaxBlockSize = 1u << 28;
uint64_t m_MaxBlockCount = BlockStoreDiskLocation::MaxBlockIndex + 1;