diff options
author | Alexey Efimov <xeno@prnwatch.com> | 2022-06-06 16:56:25 +0300 |
---|---|---|
committer | Alexey Efimov <xeno@prnwatch.com> | 2022-06-06 16:56:25 +0300 |
commit | 03f8a6c5c18ba55f9c76c7cb565bc3315040bd15 (patch) | |
tree | ef0390cbae667b9ebf552e89b1456aeebb0f3ae0 | |
parent | 780b50fea3c9c5351006caf0cfc9b69744702f0b (diff) | |
download | ydb-03f8a6c5c18ba55f9c76c7cb565bc3315040bd15.tar.gz |
browse index and cdc streams in describe handler YDB-1465
ref:1346e0d42badb86d68cc3ef3e7ca98f719b28a60
-rw-r--r-- | ydb/core/viewer/json_describe.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ydb/core/viewer/json_describe.h b/ydb/core/viewer/json_describe.h index d095783b731..3f6ec6b59c2 100644 --- a/ydb/core/viewer/json_describe.h +++ b/ydb/core/viewer/json_describe.h @@ -21,6 +21,7 @@ class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> { TAutoPtr<TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult; TJsonSettings JsonSettings; ui32 Timeout = 0; + bool ExpandSubElements = true; public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { @@ -56,6 +57,7 @@ public: JsonSettings.EnumAsNumbers = !FromStringWithDefault<bool>(params.Get("enums"), false); JsonSettings.UI64AsString = !FromStringWithDefault<bool>(params.Get("ui64"), false); Timeout = FromStringWithDefault<ui32>(params.Get("timeout"), 10000); + ExpandSubElements = FromStringWithDefault<ui32>(params.Get("subs"), ExpandSubElements); InitConfig(params); if (params.Has("schemeshard_id")) { @@ -89,6 +91,25 @@ public: TStringStream json; TString headers = Viewer->GetHTTPOKJSON(Event->Get()); if (DescribeResult != nullptr) { + if (ExpandSubElements) { + NKikimrScheme::TEvDescribeSchemeResult& describe = *(DescribeResult->MutableRecord()); + if (describe.HasPathDescription()) { + auto& pathDescription = *describe.MutablePathDescription(); + if (pathDescription.HasTable()) { + auto& table = *pathDescription.MutableTable(); + for (auto& tableIndex : table.GetTableIndexes()) { + NKikimrSchemeOp::TDirEntry& child = *pathDescription.AddChildren(); + child.SetName(tableIndex.GetName()); + child.SetPathType(NKikimrSchemeOp::EPathType::EPathTypeTableIndex); + } + for (auto& tableCdc : table.GetCdcStreams()) { + NKikimrSchemeOp::TDirEntry& child = *pathDescription.AddChildren(); + child.SetName(tableCdc.GetName()); + child.SetPathType(NKikimrSchemeOp::EPathType::EPathTypeCdcStream); + } + } + } + } TProtoToJson::ProtoToJson(json, DescribeResult->GetRecord(), JsonSettings); switch (DescribeResult->GetRecord().GetStatus()) { case NKikimrScheme::StatusAccessDenied: |