diff options
| author | Dan Engelbrecht <[email protected]> | 2024-04-24 13:53:54 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-04-24 13:53:54 +0200 |
| commit | 1c0ddc112a6c18d411f1f3ae6d236ecc2bedcfaa (patch) | |
| tree | cfafeecb830a44a6d0870a217edabcc62d37669c /src/zenstore/cas.cpp | |
| parent | remove obsolete code (diff) | |
| download | zen-1c0ddc112a6c18d411f1f3ae6d236ecc2bedcfaa.tar.xz zen-1c0ddc112a6c18d411f1f3ae6d236ecc2bedcfaa.zip | |
iterate cas chunks (#59)
- Improvement: Reworked GetChunkInfos in oplog store to reduce disk thrashing and improve performance
Diffstat (limited to 'src/zenstore/cas.cpp')
| -rw-r--r-- | src/zenstore/cas.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/zenstore/cas.cpp b/src/zenstore/cas.cpp index 2fe466028..26ec2b10d 100644 --- a/src/zenstore/cas.cpp +++ b/src/zenstore/cas.cpp @@ -57,6 +57,9 @@ public: virtual IoBuffer FindChunk(const IoHash& ChunkHash) override; virtual bool ContainsChunk(const IoHash& ChunkHash) override; virtual void FilterChunks(HashKeySet& InOutChunks) override; + virtual bool IterateChunks(std::span<IoHash> DecompressedIds, + const std::function<bool(size_t Index, const IoBuffer& Payload)>& AsyncCallback, + WorkerThreadPool* OptionalWorkerPool) override; virtual void Flush() override; virtual void ScrubStorage(ScrubContext& Ctx) override; virtual void GarbageCollect(GcContext& GcCtx) override; @@ -396,6 +399,27 @@ CasImpl::FilterChunks(HashKeySet& InOutChunks) m_LargeStrategy.FilterChunks(InOutChunks); } +bool +CasImpl::IterateChunks(std::span<IoHash> DecompressedIds, + const std::function<bool(size_t Index, const IoBuffer& Payload)>& AsyncCallback, + WorkerThreadPool* OptionalWorkerPool) +{ + ZEN_TRACE_CPU("CAS::IterateChunks"); + if (!m_SmallStrategy.IterateChunks(DecompressedIds, AsyncCallback, OptionalWorkerPool)) + { + return false; + } + if (!m_TinyStrategy.IterateChunks(DecompressedIds, AsyncCallback, OptionalWorkerPool)) + { + return false; + } + if (!m_LargeStrategy.IterateChunks(DecompressedIds, AsyncCallback)) + { + return false; + } + return true; +} + void CasImpl::Flush() { |