diff options
| author | Dan Engelbrecht <[email protected]> | 2024-04-26 14:10:20 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-04-26 14:10:20 +0200 |
| commit | 8479e339cbf0b133f97a93b110d95fd8674916d3 (patch) | |
| tree | 6a51a13cfccc77becdb53df3de40475308e470a4 /src/zenstore/cas.cpp | |
| parent | 5.5.0 (diff) | |
| download | zen-8479e339cbf0b133f97a93b110d95fd8674916d3.tar.xz zen-8479e339cbf0b133f97a93b110d95fd8674916d3.zip | |
oplog iterate chunks content type (#65)
- Bugfix: Properly set content type of chunks fetch from CidStore
- Improvement: Add IterateChunks(std::span<Oid>) for better performance in get oplog
Diffstat (limited to 'src/zenstore/cas.cpp')
| -rw-r--r-- | src/zenstore/cas.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/zenstore/cas.cpp b/src/zenstore/cas.cpp index 26ec2b10d..45d7dd277 100644 --- a/src/zenstore/cas.cpp +++ b/src/zenstore/cas.cpp @@ -365,16 +365,19 @@ CasImpl::FindChunk(const IoHash& ChunkHash) if (IoBuffer Found = m_SmallStrategy.FindChunk(ChunkHash)) { + Found.SetContentType(ZenContentType::kCompressedBinary); return Found; } if (IoBuffer Found = m_TinyStrategy.FindChunk(ChunkHash)) { + Found.SetContentType(ZenContentType::kCompressedBinary); return Found; } if (IoBuffer Found = m_LargeStrategy.FindChunk(ChunkHash)) { + Found.SetContentType(ZenContentType::kCompressedBinary); return Found; } @@ -405,15 +408,33 @@ CasImpl::IterateChunks(std::span<IoHash> DecompressedIds, WorkerThreadPool* OptionalWorkerPool) { ZEN_TRACE_CPU("CAS::IterateChunks"); - if (!m_SmallStrategy.IterateChunks(DecompressedIds, AsyncCallback, OptionalWorkerPool)) + if (!m_SmallStrategy.IterateChunks( + DecompressedIds, + [&](size_t Index, const IoBuffer& Payload) { + IoBuffer Chunk(Payload); + Chunk.SetContentType(ZenContentType::kCompressedBinary); + return AsyncCallback(Index, Payload); + }, + OptionalWorkerPool)) { return false; } - if (!m_TinyStrategy.IterateChunks(DecompressedIds, AsyncCallback, OptionalWorkerPool)) + if (!m_TinyStrategy.IterateChunks( + DecompressedIds, + [&](size_t Index, const IoBuffer& Payload) { + IoBuffer Chunk(Payload); + Chunk.SetContentType(ZenContentType::kCompressedBinary); + return AsyncCallback(Index, Payload); + }, + OptionalWorkerPool)) { return false; } - if (!m_LargeStrategy.IterateChunks(DecompressedIds, AsyncCallback)) + if (!m_LargeStrategy.IterateChunks(DecompressedIds, [&](size_t Index, const IoBuffer& Payload) { + IoBuffer Chunk(Payload); + Chunk.SetContentType(ZenContentType::kCompressedBinary); + return AsyncCallback(Index, Payload); + })) { return false; } |