diff options
| author | Martin Ridgers <[email protected]> | 2024-09-17 13:34:25 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2024-09-19 15:26:13 +0200 |
| commit | b80da26369440b92f1ce7f6665b4e3138786ff4f (patch) | |
| tree | 58e4e7c9c7d01b653b90c8c9a9572289474f4acc /src/zenserver | |
| parent | clang-format on branch's changed files (diff) | |
| download | zen-b80da26369440b92f1ce7f6665b4e3138786ff4f.tar.xz zen-b80da26369440b92f1ce7f6665b4e3138786ff4f.zip | |
Surfaced oplog paging to HTTP handler
Diffstat (limited to 'src/zenserver')
| -rw-r--r-- | src/zenserver/projectstore/httpprojectstore.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp index 9e4961889..01bff1746 100644 --- a/src/zenserver/projectstore/httpprojectstore.cpp +++ b/src/zenserver/projectstore/httpprojectstore.cpp @@ -1479,14 +1479,29 @@ HttpProjectService::HandleOpLogEntriesRequest(HttpRouterRequest& Req) { Response.BeginArray("entries"sv); + ProjectStore::Oplog::Paging EntryPaging; + if (std::string_view Param = Params.GetValue("start"); !Param.empty()) + { + if (auto Value = ParseInt<int32>(Param)) + { + EntryPaging.Start = *Value; + } + } + if (std::string_view Param = Params.GetValue("count"); !Param.empty()) + { + if (auto Value = ParseInt<int32>(Param)) + { + EntryPaging.Count = *Value; + } + } + if (FieldNamesFilter.empty()) { - FoundLog->IterateOplog([&Response](CbObjectView Op) { Response << Op; }, ProjectStore::Oplog::Paging{}); + FoundLog->IterateOplog([&Response](CbObjectView Op) { Response << Op; }, &EntryPaging); } else { - FoundLog->IterateOplog([this, &Response, &FilterObject](CbObjectView Op) { Response << FilterObject(Op); }, - ProjectStore::Oplog::Paging{}); + FoundLog->IterateOplog([this, &Response, &FilterObject](CbObjectView Op) { Response << FilterObject(Op); }, &EntryPaging); } Response.EndArray(); |