aboutsummaryrefslogtreecommitdiff
path: root/zenstore/compactcas.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-21 15:42:42 +0200
committerStefan Boberg <[email protected]>2021-09-21 15:42:42 +0200
commitbd540d333e920f3c93ebaaf2bd175194b3877c1b (patch)
tree9c97ad87207e636ce452b420b80ae6ca653420f0 /zenstore/compactcas.cpp
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-bd540d333e920f3c93ebaaf2bd175194b3877c1b.tar.xz
zen-bd540d333e920f3c93ebaaf2bd175194b3877c1b.zip
Encapsulated containers in CasChunkSet to allow for more efficient udpates/queries
Diffstat (limited to 'zenstore/compactcas.cpp')
-rw-r--r--zenstore/compactcas.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp
index f17b8d376..5fc3ac356 100644
--- a/zenstore/compactcas.cpp
+++ b/zenstore/compactcas.cpp
@@ -147,20 +147,7 @@ CasContainerStrategy::FilterChunks(CasChunkSet& InOutChunks)
// we're likely to already have a large proportion of the
// chunks in the set
- std::unordered_set<IoHash> HaveSet;
-
- for (const IoHash& Hash : InOutChunks.GetChunkSet())
- {
- if (HaveChunk(Hash))
- {
- HaveSet.insert(Hash);
- }
- }
-
- for (const IoHash& Hash : HaveSet)
- {
- InOutChunks.RemoveIfPresent(Hash);
- }
+ InOutChunks.RemoveChunksIf([&](const IoHash& Hash) { return HaveChunk(Hash); });
}
void
@@ -213,7 +200,8 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx)
continue;
}
- const IoHash ComputedHash = IoHash::HashBuffer(reinterpret_cast<uint8_t*>(BufferBase) + Entry.second.Offset - WindowStart, Entry.second.Size);
+ const IoHash ComputedHash =
+ IoHash::HashBuffer(reinterpret_cast<uint8_t*>(BufferBase) + Entry.second.Offset - WindowStart, Entry.second.Size);
if (Entry.first != ComputedHash)
{