diff options
author | andrew-rykov <[email protected]> | 2023-09-29 17:01:11 +0300 |
---|---|---|
committer | andrew-rykov <[email protected]> | 2023-09-29 17:26:25 +0300 |
commit | 47efa805f712db541a1a84d861567ef949a88afa (patch) | |
tree | 1f72053a25be6196d5cecc6adfc4046786edd063 | |
parent | 93fa7ac68f02e9049807270c7c3970782497a69c (diff) |
added storage handler limit offset
-rw-r--r-- | ydb/core/viewer/json_storage.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ydb/core/viewer/json_storage.h b/ydb/core/viewer/json_storage.h index 1c3531edd98..a64fcf8db41 100644 --- a/ydb/core/viewer/json_storage.h +++ b/ydb/core/viewer/json_storage.h @@ -31,7 +31,7 @@ class TJsonStorage : public TJsonStorageBase { }; enum class EVersion { v1, - v2 // only this works with sorting and filtering with usage buckets + v2 // only this works with sorting, limiting and filtering with usage buckets }; EVersion Version = EVersion::v1; EGroupSort GroupSort = EGroupSort::PoolName; @@ -397,9 +397,14 @@ public: break; } - for (const auto& groupRow: GroupRows) { + ui32 start = Offset.has_value() ? Offset.value() : 0; + ui32 end = GroupRows.size(); + if (Limit.has_value()) { + end = Min(end, start + Limit.value()); + } + for (ui32 i = start; i < end; ++i) { NKikimrViewer::TStorageGroupInfo* group = StorageInfo.AddStorageGroups(); - group->SetGroupId(groupRow.GroupId); + group->SetGroupId(GroupRows[i].GroupId); } } |