aboutsummaryrefslogtreecommitdiff
path: root/zenstore/compactcas.cpp
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/compactcas.cpp
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/compactcas.cpp')
-rw-r--r--zenstore/compactcas.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp
index 5a0ba974b..c6115024b 100644
--- a/zenstore/compactcas.cpp
+++ b/zenstore/compactcas.cpp
@@ -250,16 +250,15 @@ CasContainerStrategy::InsertChunk(const void* ChunkData, size_t ChunkSize, const
// This should be a rare occasion and the current flow reduces the time we block for
// reads, insert and GC.
- m_BlockStore.WriteChunk(ChunkData, ChunkSize, m_PayloadAlignment, [this, &ChunkHash, ChunkSize](const BlockStoreLocation& Location) {
- BlockStoreDiskLocation DiskLocation(Location, m_PayloadAlignment);
- const CasDiskIndexEntry IndexEntry{.Key = ChunkHash, .Location = DiskLocation};
- m_CasLog.Append(IndexEntry);
- {
- RwLock::ExclusiveLockScope _(m_LocationMapLock);
- m_LocationMap.emplace(ChunkHash, DiskLocation);
- }
- m_TotalSize.fetch_add(static_cast<uint64_t>(ChunkSize), std::memory_order_seq_cst);
- });
+ BlockStoreLocation Location = m_BlockStore.WriteChunk(ChunkData, ChunkSize, m_PayloadAlignment);
+ BlockStoreDiskLocation DiskLocation(Location, m_PayloadAlignment);
+ const CasDiskIndexEntry IndexEntry{.Key = ChunkHash, .Location = DiskLocation};
+ m_CasLog.Append(IndexEntry);
+ {
+ RwLock::ExclusiveLockScope _(m_LocationMapLock);
+ m_LocationMap.emplace(ChunkHash, DiskLocation);
+ }
+ m_TotalSize.fetch_add(static_cast<uint64_t>(ChunkSize), std::memory_order_seq_cst);
return CasStore::InsertResult{.New = true};
}