diff options
| author | Martin Ridgers <[email protected]> | 2024-09-17 13:26:52 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2024-09-19 15:26:13 +0200 |
| commit | 7f6e6461279b11d1fd60d24b4a490d608d47f51a (patch) | |
| tree | aad99d7f18607adf659ea42410470475e3679bce /src | |
| parent | Removed redundant initialisation (diff) | |
| download | zen-7f6e6461279b11d1fd60d24b4a490d608d47f51a.tar.xz zen-7f6e6461279b11d1fd60d24b4a490d608d47f51a.zip | |
Mandatory IterateOplog() paging argument
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenserver/projectstore/httpprojectstore.cpp | 4 | ||||
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 21 | ||||
| -rw-r--r-- | src/zenserver/projectstore/projectstore.h | 4 | ||||
| -rw-r--r-- | src/zenserver/vfs/vfsimpl.cpp | 2 |
4 files changed, 14 insertions, 17 deletions
diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp index 28506145b..45a396f02 100644 --- a/src/zenserver/projectstore/httpprojectstore.cpp +++ b/src/zenserver/projectstore/httpprojectstore.cpp @@ -1481,11 +1481,11 @@ HttpProjectService::HandleOpLogEntriesRequest(HttpRouterRequest& Req) if (FieldNamesFilter.empty()) { - FoundLog->IterateOplog([&Response](CbObjectView Op) { Response << Op; }); + FoundLog->IterateOplog([&Response](CbObjectView Op) { Response << Op; }, ProjectStore::Oplog::Paging{}); } else { - FoundLog->IterateOplog([this, &Response, &FilterObject](CbObjectView Op) { Response << FilterObject(Op); }); + FoundLog->IterateOplog([this, &Response, &FilterObject](CbObjectView Op) { Response << FilterObject(Op); }, ProjectStore::Oplog::Paging{}); } Response.EndArray(); diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index ea45aa210..75a077e87 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -1100,7 +1100,7 @@ ProjectStore::Oplog::GatherReferences(GcContext& GcCtx) GcCtx.AddRetainedCids(Cids); Cids.clear(); } - }); + }, Paging{}); GcCtx.AddRetainedCids(Cids); } @@ -2032,14 +2032,14 @@ ProjectStore::Oplog::IterateFileMap( } void -ProjectStore::Oplog::IterateOplog(std::function<void(CbObjectView)>&& Handler, const Paging* EntryPaging) +ProjectStore::Oplog::IterateOplog(std::function<void(CbObjectView)>&& Handler, const Paging& EntryPaging) { RwLock::SharedLockScope _(m_OplogLock); IterateOplogLocked(std::move(Handler), EntryPaging); } void -ProjectStore::Oplog::IterateOplogLocked(std::function<void(CbObjectView)>&& Handler, const Paging* EntryPaging) +ProjectStore::Oplog::IterateOplogLocked(std::function<void(CbObjectView)>&& Handler, const Paging& EntryPaging) { ZEN_TRACE_CPU("Store::Oplog::IterateOplogLocked"); if (!m_Storage) @@ -2063,13 +2063,10 @@ ProjectStore::Oplog::IterateOplogLocked(std::function<void(CbObjectView)>&& Hand }); std::span<OplogEntryAddress> EntrySpan = Entries; - if (EntryPaging != nullptr) - { - int32_t Size = int32_t(Entries.size()); - int32_t Start = std::clamp(EntryPaging->Start, 0, Size); - int32_t End = std::clamp(EntryPaging->Start + EntryPaging->Count, 0, Size); - EntrySpan = EntrySpan.subspan(Start, End - Start); - } + int32_t Size = int32_t(Entries.size()); + int32_t Start = std::clamp(EntryPaging.Start, 0, Size); + int32_t End = std::clamp(EntryPaging.Start + EntryPaging.Count, 0, Size); + EntrySpan = EntrySpan.subspan(Start, End - Start); m_Storage->ReplayLogEntries(EntrySpan, [&](CbObjectView Op) { Handler(Op); }); } @@ -2123,7 +2120,7 @@ ProjectStore::Oplog::GetAttachmentsLocked(std::vector<IoHash>& OutAttachments, b Keys.push_back(KeyHash); AttachmentCounts.push_back(gsl::narrow<uint32_t>(OutAttachments.size() - CurrentAttachmentCount)); } - }); + }, Paging{}); if (StoreMetaDataOnDisk) { const IoHash* FirstAttachment = OutAttachments.data() + AttachmentOffset; @@ -4863,7 +4860,7 @@ ProjectStore::Rpc(HttpServerRequest& HttpReq, } OpCount++; - }); + }, Oplog::Paging{}); // Make sure we have references to our attachments Oplog->AddChunkMappings(NewChunkMappings); diff --git a/src/zenserver/projectstore/projectstore.h b/src/zenserver/projectstore/projectstore.h index f98ac7f11..891821382 100644 --- a/src/zenserver/projectstore/projectstore.h +++ b/src/zenserver/projectstore/projectstore.h @@ -104,9 +104,9 @@ public: std::vector<ChunkInfo> GetAllChunksInfo(); void IterateChunkMap(std::function<void(const Oid&, const IoHash& Hash)>&& Fn); void IterateFileMap(std::function<void(const Oid&, const std::string_view& ServerPath, const std::string_view& ClientPath)>&& Fn); - void IterateOplog(std::function<void(CbObjectView)>&& Fn, const Paging* EntryPaging = nullptr); + void IterateOplog(std::function<void(CbObjectView)>&& Fn, const Paging& EntryPaging); void IterateOplogWithKey(std::function<void(uint32_t, const Oid&, CbObjectView)>&& Fn); - void IterateOplogLocked(std::function<void(CbObjectView)>&& Fn, const Paging* EntryPaging = nullptr); + void IterateOplogLocked(std::function<void(CbObjectView)>&& Fn, const Paging& EntryPaging); size_t GetOplogEntryCount() const; std::optional<CbObject> GetOpByKey(const Oid& Key); diff --git a/src/zenserver/vfs/vfsimpl.cpp b/src/zenserver/vfs/vfsimpl.cpp index 292fce9eb..80de1e1a5 100644 --- a/src/zenserver/vfs/vfsimpl.cpp +++ b/src/zenserver/vfs/vfsimpl.cpp @@ -399,7 +399,7 @@ VfsServiceDataSource::PopulateDirectory(std::string NodePath, VfsTreeNode& DirNo Oplog->IterateOplog([&](CbObjectView Op) { EmitFilesForDataArray(Op["packagedata"sv].AsArrayView()); EmitFilesForDataArray(Op["bulkdata"sv].AsArrayView()); - }); + }, ProjectStore::Oplog::Paging{}); DirNode.AddFileNode("stats.json", 42, Oid::Zero); } |