ydb-embedded-ui 4.10.0 → 4.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/components/InfoViewer/formatters/schema.ts +3 -1
  3. package/dist/components/TableWithControlsLayout/TableWithControlsLayout.scss +32 -0
  4. package/dist/components/TableWithControlsLayout/TableWithControlsLayout.tsx +43 -0
  5. package/dist/containers/AsideNavigation/AsideNavigation.tsx +2 -2
  6. package/dist/containers/Cluster/Cluster.scss +4 -5
  7. package/dist/containers/Cluster/Cluster.tsx +3 -22
  8. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +4 -0
  9. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +7 -0
  10. package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.tsx +1 -1
  11. package/dist/containers/Cluster/utils.tsx +0 -11
  12. package/dist/containers/Header/Header.scss +1 -5
  13. package/dist/containers/Nodes/Nodes.scss +1 -24
  14. package/dist/containers/Nodes/Nodes.tsx +28 -38
  15. package/dist/containers/Storage/Storage.scss +1 -14
  16. package/dist/containers/Storage/Storage.tsx +15 -18
  17. package/dist/containers/Storage/StorageTypeFilter/StorageTypeFilter.tsx +3 -1
  18. package/dist/containers/Storage/{StorageVisibleEntityFilter/StorageVisibleEntityFilter.tsx → StorageVisibleEntitiesFilter/StorageVisibleEntitiesFilter.tsx} +4 -2
  19. package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +6 -2
  20. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +3 -12
  21. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +2 -7
  22. package/dist/containers/Tenant/Query/i18n/en.json +1 -1
  23. package/dist/containers/Tenant/Query/i18n/ru.json +1 -1
  24. package/dist/containers/Tenants/Tenants.scss +1 -13
  25. package/dist/containers/Tenants/Tenants.tsx +17 -24
  26. package/dist/store/reducers/nodes/nodes.ts +4 -112
  27. package/dist/store/reducers/nodes/selectors.ts +74 -0
  28. package/dist/store/reducers/nodes/utils.ts +46 -0
  29. package/dist/store/reducers/storage/selectors.ts +1 -1
  30. package/dist/types/api/compute.ts +27 -2
  31. package/dist/types/api/nodes.ts +12 -1
  32. package/dist/types/api/schema/cdcStream.ts +32 -0
  33. package/dist/types/api/schema/columnEntity.ts +138 -0
  34. package/dist/types/api/schema/externalDataSource.ts +24 -0
  35. package/dist/types/api/schema/externalTable.ts +14 -0
  36. package/dist/types/api/schema/index.ts +10 -0
  37. package/dist/types/api/schema/persQueueGroup.ts +191 -0
  38. package/dist/types/api/schema/schema.ts +299 -0
  39. package/dist/types/api/schema/shared.ts +42 -0
  40. package/dist/types/api/schema/table.ts +616 -0
  41. package/dist/types/api/schema/tableIndex.ts +33 -0
  42. package/package.json +1 -1
  43. package/dist/assets/icons/versions.svg +0 -3
  44. package/dist/types/api/schema.ts +0 -1326
@@ -48,10 +48,7 @@ import {
48
48
  } from '../utils/paneVisibilityToggleHelpers';
49
49
  import {setShowPreview} from '../../../store/reducers/schema/schema';
50
50
  import {setQueryTab, setTenantPage} from '../../../store/reducers/tenant/tenant';
51
- import {
52
- TENANT_PAGES_IDS,
53
- TENANT_QUERY_TABS_ID,
54
- } from '../../../store/reducers/tenant/constants';
51
+ import {TENANT_PAGES_IDS, TENANT_QUERY_TABS_ID} from '../../../store/reducers/tenant/constants';
55
52
 
56
53
  import './ObjectSummary.scss';
57
54
 
@@ -246,9 +243,7 @@ function ObjectSummary(props: ObjectSummaryProps) {
246
243
  const renderTree = () => {
247
244
  return (
248
245
  <div className={b('tree-wrapper')}>
249
- <div className={b('tree-header')}>
250
- <div className={b('tree-title')}>Navigation</div>
251
- </div>
246
+ <div className={b('tree-header')}>Navigation</div>
252
247
  <div className={b('tree')}>
253
248
  {pathData && (
254
249
  <SchemaTree
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "controls.query-mode-selector_type": "Query type:",
3
3
 
4
- "tabs.newQuery": "New query",
4
+ "tabs.newQuery": "Query",
5
5
  "tabs.history": "History",
6
6
  "tabs.saved": "Saved",
7
7
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "controls.query-mode-selector_type": "Тип запроса:",
3
3
 
4
- "tabs.newQuery": "Новый запрос",
4
+ "tabs.newQuery": "Запрос",
5
5
  "tabs.history": "История",
6
6
  "tabs.saved": "Сохраненные",
7
7
 
@@ -1,9 +1,6 @@
1
1
  @import '../../styles/mixins.scss';
2
2
 
3
3
  .tenants {
4
- height: 100%;
5
- @include flex-container();
6
-
7
4
  &__format-label {
8
5
  margin-right: 15px;
9
6
  }
@@ -28,16 +25,7 @@
28
25
  }
29
26
  }
30
27
 
31
- &__controls {
32
- @include controls();
33
- }
34
-
35
- &__table-wrapper {
36
- overflow: auto;
37
- flex-grow: 1;
38
-
39
- @include freeze-nth-column(1);
40
-
28
+ &__table {
41
29
  @include table-styles;
42
30
  }
43
31
 
@@ -2,7 +2,7 @@ import cn from 'bem-cn-lite';
2
2
  import {useDispatch} from 'react-redux';
3
3
 
4
4
  import DataTable, {Column} from '@gravity-ui/react-data-table';
5
- import {Loader, Button} from '@gravity-ui/uikit';
5
+ import {Button} from '@gravity-ui/uikit';
6
6
 
7
7
  import EntityStatus from '../../components/EntityStatus/EntityStatus';
8
8
  import {PoolsGraph} from '../../components/PoolsGraph/PoolsGraph';
@@ -10,6 +10,7 @@ import {TabletsStatistic} from '../../components/TabletsStatistic';
10
10
  import {ProblemFilter} from '../../components/ProblemFilter';
11
11
  import {Illustration} from '../../components/Illustration';
12
12
  import {Search} from '../../components/Search';
13
+ import {TableWithControlsLayout} from '../../components/TableWithControlsLayout/TableWithControlsLayout';
13
14
  import {ResponseError} from '../../components/Errors/ResponseError';
14
15
 
15
16
  import type {AdditionalTenantsProps} from '../../types/additionalProps';
@@ -66,7 +67,7 @@ export const Tenants = ({additionalTenantsProps}: TenantsProps) => {
66
67
 
67
68
  const renderControls = () => {
68
69
  return (
69
- <div className={b('controls')}>
70
+ <>
70
71
  <Search
71
72
  value={searchValue}
72
73
  onChange={handleSearchChange}
@@ -74,7 +75,7 @@ export const Tenants = ({additionalTenantsProps}: TenantsProps) => {
74
75
  className={b('search')}
75
76
  />
76
77
  <ProblemFilter value={problemFilter} onChange={handleProblemFilterChange} />
77
- </div>
78
+ </>
78
79
  );
79
80
  };
80
81
 
@@ -236,34 +237,26 @@ export const Tenants = ({additionalTenantsProps}: TenantsProps) => {
236
237
  }
237
238
 
238
239
  return (
239
- <div className={b('table-wrapper')}>
240
- <DataTable
241
- theme="yandex-cloud"
242
- data={filteredTenants}
243
- columns={columns}
244
- settings={DEFAULT_TABLE_SETTINGS}
245
- emptyDataMessage="No such tenants"
246
- />
247
- </div>
240
+ <DataTable
241
+ theme="yandex-cloud"
242
+ data={filteredTenants}
243
+ columns={columns}
244
+ settings={DEFAULT_TABLE_SETTINGS}
245
+ emptyDataMessage="No such tenants"
246
+ />
248
247
  );
249
248
  };
250
249
 
251
- if (loading && !wasLoaded) {
252
- return (
253
- <div className={'loader'}>
254
- <Loader size="l" />
255
- </div>
256
- );
257
- }
258
-
259
250
  if (error) {
260
251
  return <ResponseError error={error} />;
261
252
  }
262
253
 
263
254
  return (
264
- <div className={b()}>
265
- {renderControls()}
266
- {renderTable()}
267
- </div>
255
+ <TableWithControlsLayout>
256
+ <TableWithControlsLayout.Controls>{renderControls()}</TableWithControlsLayout.Controls>
257
+ <TableWithControlsLayout.Table loading={loading && !wasLoaded} className={b('table')}>
258
+ {renderTable()}
259
+ </TableWithControlsLayout.Table>
260
+ </TableWithControlsLayout>
268
261
  );
269
262
  };
@@ -1,25 +1,12 @@
1
1
  import type {Reducer} from 'redux';
2
- import {createSelector, Selector} from 'reselect';
3
- import {escapeRegExp} from 'lodash/fp';
4
2
 
5
3
  import '../../../services/api';
6
- import {HOUR_IN_SECONDS} from '../../../utils/constants';
7
- import {calcUptime, calcUptimeInSeconds} from '../../../utils';
8
4
  import {NodesUptimeFilterValues} from '../../../utils/nodes';
9
- import {EFlag} from '../../../types/api/enums';
10
5
 
11
- import type {ProblemFilterValue} from '../settings/types';
12
6
  import {createRequestActionTypes, createApiRequest} from '../../utils';
13
- import {ProblemFilterValues} from '../settings/settings';
14
7
 
15
- import type {
16
- NodesAction,
17
- NodesApiRequestParams,
18
- NodesHandledResponse,
19
- NodesPreparedEntity,
20
- NodesStateSlice,
21
- NodesState,
22
- } from './types';
8
+ import type {NodesAction, NodesApiRequestParams, NodesState} from './types';
9
+ import {prepareComputeNodesData, prepareNodesData} from './utils';
23
10
 
24
11
  export const FETCH_NODES = createRequestActionTypes('nodes', 'FETCH_NODES');
25
12
 
@@ -97,24 +84,7 @@ export function getNodes({tenant, visibleEntities, type = 'any'}: NodesApiReques
97
84
  return createApiRequest({
98
85
  request: window.api.getNodes({tenant, visibleEntities, type}),
99
86
  actions: FETCH_NODES,
100
- dataHandler: (data): NodesHandledResponse => {
101
- const rawNodes = data.Nodes || [];
102
-
103
- const preparedNodes = rawNodes.map((node) => {
104
- return {
105
- ...node?.SystemState,
106
- Tablets: node?.Tablets,
107
- NodeId: node?.NodeId,
108
- Uptime: calcUptime(node?.SystemState?.StartTime),
109
- TenantName: node?.SystemState?.Tenants?.[0],
110
- };
111
- });
112
-
113
- return {
114
- Nodes: preparedNodes,
115
- TotalNodes: Number(data.TotalNodes) || preparedNodes.length,
116
- };
117
- },
87
+ dataHandler: prepareNodesData,
118
88
  });
119
89
  }
120
90
 
@@ -122,31 +92,7 @@ export function getComputeNodes(path: string) {
122
92
  return createApiRequest({
123
93
  request: window.api.getCompute(path),
124
94
  actions: FETCH_NODES,
125
- dataHandler: (data): NodesHandledResponse => {
126
- const preparedNodes: NodesPreparedEntity[] = [];
127
-
128
- if (data.Tenants) {
129
- for (const tenant of data.Tenants) {
130
- if (tenant && tenant.Nodes) {
131
- const tenantNodes = tenant.Nodes.map((node) => {
132
- return {
133
- ...node,
134
- TenantName: tenant.Name,
135
- SystemState: node?.Overall,
136
- Uptime: calcUptime(node?.StartTime),
137
- };
138
- });
139
-
140
- preparedNodes.push(...tenantNodes);
141
- }
142
- }
143
- }
144
-
145
- return {
146
- Nodes: preparedNodes,
147
- TotalNodes: preparedNodes.length,
148
- };
149
- },
95
+ dataHandler: prepareComputeNodesData,
150
96
  });
151
97
  }
152
98
 
@@ -175,58 +121,4 @@ export const setSearchValue = (value: string) => {
175
121
  } as const;
176
122
  };
177
123
 
178
- const getNodesUptimeFilter = (state: NodesStateSlice) => state.nodes.nodesUptimeFilter;
179
- const getSearchValue = (state: NodesStateSlice) => state.nodes.searchValue;
180
- const getNodesList = (state: NodesStateSlice) => state.nodes.data;
181
-
182
- const filterNodesByProblemsStatus = (
183
- nodesList: NodesPreparedEntity[] = [],
184
- problemFilter: ProblemFilterValue,
185
- ) => {
186
- if (problemFilter === ProblemFilterValues.ALL) {
187
- return nodesList;
188
- }
189
-
190
- return nodesList.filter(({SystemState}) => {
191
- return SystemState && SystemState !== EFlag.Green;
192
- });
193
- };
194
-
195
- export const filterNodesByUptime = <T extends {StartTime?: string}>(
196
- nodesList: T[] = [],
197
- nodesUptimeFilter: NodesUptimeFilterValues,
198
- ) => {
199
- if (nodesUptimeFilter === NodesUptimeFilterValues.All) {
200
- return nodesList;
201
- }
202
- return nodesList.filter(({StartTime}) => {
203
- return !StartTime || calcUptimeInSeconds(StartTime) < HOUR_IN_SECONDS;
204
- });
205
- };
206
-
207
- const filterNodesBySearchValue = (nodesList: NodesPreparedEntity[] = [], searchValue: string) => {
208
- if (!searchValue) {
209
- return nodesList;
210
- }
211
- const re = new RegExp(escapeRegExp(searchValue), 'i');
212
-
213
- return nodesList.filter((node) => {
214
- return node.Host ? re.test(node.Host) || re.test(String(node.NodeId)) : true;
215
- });
216
- };
217
-
218
- export const getFilteredPreparedNodesList: Selector<
219
- NodesStateSlice,
220
- NodesPreparedEntity[] | undefined
221
- > = createSelector(
222
- [getNodesList, getNodesUptimeFilter, getSearchValue, (state) => state.settings.problemFilter],
223
- (nodesList, uptimeFilter, searchValue, problemFilter) => {
224
- let result = filterNodesByUptime(nodesList, uptimeFilter);
225
- result = filterNodesByProblemsStatus(result, problemFilter);
226
- result = filterNodesBySearchValue(result, searchValue);
227
-
228
- return result;
229
- },
230
- );
231
-
232
124
  export default nodes;
@@ -0,0 +1,74 @@
1
+ import {Selector, createSelector} from 'reselect';
2
+ import {escapeRegExp} from 'lodash';
3
+
4
+ import {EFlag} from '../../../types/api/enums';
5
+ import {calcUptimeInSeconds} from '../../../utils';
6
+ import {HOUR_IN_SECONDS} from '../../../utils/constants';
7
+ import {NodesUptimeFilterValues} from '../../../utils/nodes';
8
+
9
+ import type {ProblemFilterValue} from '../settings/types';
10
+ import type {NodesPreparedEntity, NodesStateSlice} from './types';
11
+ import {ProblemFilterValues} from '../settings/settings';
12
+
13
+ // ==== Filters ====
14
+
15
+ const filterNodesByProblemsStatus = (
16
+ nodesList: NodesPreparedEntity[] = [],
17
+ problemFilter: ProblemFilterValue,
18
+ ) => {
19
+ if (problemFilter === ProblemFilterValues.ALL) {
20
+ return nodesList;
21
+ }
22
+
23
+ return nodesList.filter(({SystemState}) => {
24
+ return SystemState && SystemState !== EFlag.Green;
25
+ });
26
+ };
27
+
28
+ export const filterNodesByUptime = <T extends {StartTime?: string}>(
29
+ nodesList: T[] = [],
30
+ nodesUptimeFilter: NodesUptimeFilterValues,
31
+ ) => {
32
+ if (nodesUptimeFilter === NodesUptimeFilterValues.All) {
33
+ return nodesList;
34
+ }
35
+ return nodesList.filter(({StartTime}) => {
36
+ return !StartTime || calcUptimeInSeconds(StartTime) < HOUR_IN_SECONDS;
37
+ });
38
+ };
39
+
40
+ const filterNodesBySearchValue = (nodesList: NodesPreparedEntity[] = [], searchValue: string) => {
41
+ if (!searchValue) {
42
+ return nodesList;
43
+ }
44
+ const re = new RegExp(escapeRegExp(searchValue), 'i');
45
+
46
+ return nodesList.filter((node) => {
47
+ return node.Host ? re.test(node.Host) || re.test(String(node.NodeId)) : true;
48
+ });
49
+ };
50
+
51
+ // ==== Simple selectors ====
52
+
53
+ const selectNodesUptimeFilter = (state: NodesStateSlice) => state.nodes.nodesUptimeFilter;
54
+ const selectSearchValue = (state: NodesStateSlice) => state.nodes.searchValue;
55
+ const selectNodesList = (state: NodesStateSlice) => state.nodes.data;
56
+
57
+ // ==== Complex selectors ====
58
+
59
+ export const selectFilteredNodes: Selector<NodesStateSlice, NodesPreparedEntity[] | undefined> =
60
+ createSelector(
61
+ [
62
+ selectNodesList,
63
+ selectNodesUptimeFilter,
64
+ selectSearchValue,
65
+ (state) => state.settings.problemFilter,
66
+ ],
67
+ (nodesList, uptimeFilter, searchValue, problemFilter) => {
68
+ let result = filterNodesByUptime(nodesList, uptimeFilter);
69
+ result = filterNodesByProblemsStatus(result, problemFilter);
70
+ result = filterNodesBySearchValue(result, searchValue);
71
+
72
+ return result;
73
+ },
74
+ );
@@ -0,0 +1,46 @@
1
+ import type {TComputeInfo} from '../../../types/api/compute';
2
+ import type {TNodesInfo} from '../../../types/api/nodes';
3
+ import {calcUptime} from '../../../utils';
4
+
5
+ import type {NodesHandledResponse, NodesPreparedEntity} from './types';
6
+
7
+ export const prepareComputeNodesData = (data: TComputeInfo): NodesHandledResponse => {
8
+ const preparedNodes: NodesPreparedEntity[] = [];
9
+
10
+ if (data.Tenants) {
11
+ for (const tenant of data.Tenants) {
12
+ tenant.Nodes?.forEach((node) => {
13
+ preparedNodes.push({
14
+ ...node,
15
+ TenantName: tenant.Name,
16
+ SystemState: node?.Overall,
17
+ Uptime: calcUptime(node?.StartTime),
18
+ });
19
+ });
20
+ }
21
+ }
22
+
23
+ return {
24
+ Nodes: preparedNodes,
25
+ TotalNodes: preparedNodes.length,
26
+ };
27
+ };
28
+
29
+ export const prepareNodesData = (data: TNodesInfo): NodesHandledResponse => {
30
+ const rawNodes = data.Nodes || [];
31
+
32
+ const preparedNodes = rawNodes.map((node) => {
33
+ return {
34
+ ...node.SystemState,
35
+ Tablets: node.Tablets,
36
+ NodeId: node.NodeId,
37
+ Uptime: calcUptime(node.SystemState?.StartTime),
38
+ TenantName: node.SystemState?.Tenants?.[0],
39
+ };
40
+ });
41
+
42
+ return {
43
+ Nodes: preparedNodes,
44
+ TotalNodes: Number(data.TotalNodes) ?? preparedNodes.length,
45
+ };
46
+ };
@@ -15,7 +15,7 @@ import type {
15
15
  StorageStateSlice,
16
16
  UsageFilter,
17
17
  } from './types';
18
- import {filterNodesByUptime} from '../nodes/nodes';
18
+ import {filterNodesByUptime} from '../nodes/selectors';
19
19
 
20
20
  // ==== Prepare data ====
21
21
  const FLAGS_POINTS = {
@@ -4,13 +4,20 @@ import {TMetrics} from './tenant';
4
4
 
5
5
  /**
6
6
  * endpoint: viewer/json/compute
7
- *
7
+ *
8
8
  * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
9
+ *
10
+ * response has 2 versions, depending on version param in request
9
11
  */
10
12
  export interface TComputeInfo {
11
13
  Overall: EFlag;
12
- Tenants?: TComputeTenantInfo[];
14
+ Tenants?: TComputeTenantInfo[]; // v1
13
15
  Errors?: string[];
16
+ /** uint64 */
17
+ TotalNodes: string;
18
+ /** uint64 */
19
+ FoundNodes: string;
20
+ Nodes?: TComputeNodeInfo[]; // v2
14
21
  }
15
22
 
16
23
  interface TComputeTenantInfo {
@@ -43,6 +50,7 @@ export interface TComputeNodeInfo {
43
50
  MemoryLimit?: string;
44
51
  Metrics: TMetrics;
45
52
  Tablets?: TTabletStateInfo[];
53
+ Tenant?: string; // For v2 response without grouping by tenants
46
54
  }
47
55
 
48
56
  // Tablets in compute nodes
@@ -52,3 +60,20 @@ export interface TTabletStateInfo {
52
60
  State: EFlag;
53
61
  Count: number;
54
62
  }
63
+
64
+ export enum EVersion {
65
+ v1,
66
+ v2, // only this versions works with sorting
67
+ }
68
+
69
+ export enum ESort {
70
+ NodeId,
71
+ Host,
72
+ DC,
73
+ Rack,
74
+ Version,
75
+ Uptime,
76
+ Memory,
77
+ CPU,
78
+ LoadAverage,
79
+ }
@@ -5,7 +5,7 @@ import {TVDiskStateInfo} from './vdisk';
5
5
 
6
6
  /**
7
7
  * endpoint: /viewer/json/nodes
8
- *
8
+ *
9
9
  * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
10
10
  */
11
11
  export interface TNodesInfo {
@@ -101,3 +101,14 @@ enum EConfigState {
101
101
  'Consistent' = 'Consistent',
102
102
  'Outdated' = 'Outdated',
103
103
  }
104
+
105
+ export enum ESort {
106
+ NodeId,
107
+ Host,
108
+ DC,
109
+ Version,
110
+ Uptime,
111
+ Memory,
112
+ CPU,
113
+ LoadAverage,
114
+ }
@@ -0,0 +1,32 @@
1
+ import type {TPathID} from './shared';
2
+
3
+ export interface TCdcStreamDescription {
4
+ Name?: string;
5
+ Mode?: ECdcStreamMode;
6
+ Format?: ECdcStreamFormat;
7
+ PathId?: TPathID;
8
+ State?: ECdcStreamState;
9
+ /** uint64 */
10
+ SchemaVersion?: string;
11
+ }
12
+
13
+ enum ECdcStreamMode {
14
+ ECdcStreamModeInvalid = 'ECdcStreamModeInvalid',
15
+ ECdcStreamModeKeysOnly = 'ECdcStreamModeKeysOnly',
16
+ ECdcStreamModeUpdate = 'ECdcStreamModeUpdate',
17
+ ECdcStreamModeNewImage = 'ECdcStreamModeNewImage',
18
+ ECdcStreamModeOldImage = 'ECdcStreamModeOldImage',
19
+ ECdcStreamModeNewAndOldImages = 'ECdcStreamModeNewAndOldImages',
20
+ }
21
+
22
+ enum ECdcStreamFormat {
23
+ ECdcStreamFormatInvalid = 'ECdcStreamFormatInvalid',
24
+ ECdcStreamFormatProto = 'ECdcStreamFormatProto',
25
+ ECdcStreamFormatJson = 'ECdcStreamFormatJson',
26
+ }
27
+
28
+ enum ECdcStreamState {
29
+ ECdcStreamStateInvalid = 'ECdcStreamStateInvalid',
30
+ ECdcStreamStateReady = 'ECdcStreamStateReady',
31
+ ECdcStreamStateDisabled = 'ECdcStreamStateDisabled',
32
+ }
@@ -0,0 +1,138 @@
1
+ import type {EColumnCodec, EUnit, TPathID, TStorageSettings, TTypeInfo} from './shared';
2
+
3
+ export interface TColumnTableDescription {
4
+ Name?: string;
5
+
6
+ Schema?: TColumnTableSchema;
7
+ TtlSettings?: TColumnDataLifeCycle;
8
+
9
+ SchemaPresetId?: number;
10
+ SchemaPresetName?: string;
11
+
12
+ ColumnStorePathId?: TPathID;
13
+
14
+ ColumnShardCount?: number;
15
+ Sharding?: TColumnTableSharding;
16
+
17
+ /** uint64 */
18
+ SchemaPresetVersionAdj?: string;
19
+ /** uint64 */
20
+ TtlSettingsPresetVersionAdj?: string;
21
+
22
+ StorageConfig?: TColumnStorageConfig;
23
+ }
24
+
25
+ export interface TColumnStoreDescription {
26
+ Name?: string;
27
+ ColumnShardCount?: number;
28
+
29
+ /** uint64 */
30
+ ColumnShards?: string[];
31
+
32
+ SchemaPresets?: TColumnTableSchemaPreset[];
33
+ StorageConfig?: TColumnStorageConfig;
34
+
35
+ NextSchemaPresetId?: number;
36
+ NextTtlSettingsPresetId?: number;
37
+ }
38
+
39
+ export interface TColumnDataLifeCycle {
40
+ Enabled?: TTtl;
41
+ Disabled?: {};
42
+ Tiering?: TStorageTiering;
43
+
44
+ /** uint64 */
45
+ Version?: string;
46
+ }
47
+
48
+ interface TColumnStorageConfig {
49
+ SysLog?: TStorageSettings;
50
+ Log?: TStorageSettings;
51
+ Data?: TStorageSettings;
52
+ DataChannelCount?: number;
53
+ }
54
+
55
+ interface TStorageTiering {
56
+ Tiers?: TStorageTier[];
57
+ }
58
+
59
+ interface TStorageTier {
60
+ Name?: string;
61
+ Eviction?: TTtl;
62
+ }
63
+
64
+ interface TTtl {
65
+ ColumnName?: string;
66
+
67
+ ExpireAfterSeconds?: number;
68
+
69
+ /** uint64 */
70
+ ExpireAfterBytes?: string;
71
+
72
+ ColumnUnit?: EUnit;
73
+ }
74
+
75
+ interface TColumnTableSchema {
76
+ Columns?: TOlapColumnDescription[];
77
+ KeyColumnNames?: string[];
78
+ Engine?: EColumnTableEngine;
79
+ NextColumnId?: number;
80
+
81
+ /** uint64 */
82
+ Version?: string;
83
+
84
+ DefaultCompression?: TCompressionOptions;
85
+ EnableTiering?: boolean;
86
+ }
87
+
88
+ interface TColumnTableSchemaPreset {
89
+ Id?: number;
90
+ Name?: string;
91
+ Schema?: TColumnTableSchema;
92
+ }
93
+
94
+ interface TOlapColumnDescription {
95
+ Id?: number;
96
+ Name?: string;
97
+ Type?: string;
98
+ TypeId?: number;
99
+ TypeInfo?: TTypeInfo;
100
+ }
101
+
102
+ interface TColumnTableSharding {
103
+ /** uint64 */
104
+ Version?: string;
105
+
106
+ /** uint64 */
107
+ ColumnShards?: string[];
108
+
109
+ /** uint64 */
110
+ AdditionalColumnShards?: string[];
111
+
112
+ UniquePrimaryKey?: boolean;
113
+
114
+ RandomSharding?: {};
115
+ HashSharding?: THashSharding;
116
+ }
117
+
118
+ interface THashSharding {
119
+ Function?: EHashFunction;
120
+ Columns?: string[];
121
+ UniqueShardKey?: boolean;
122
+ ActiveShardsCount?: number;
123
+ }
124
+
125
+ interface TCompressionOptions {
126
+ CompressionCodec?: EColumnCodec;
127
+ CompressionLevel?: number;
128
+ }
129
+
130
+ enum EHashFunction {
131
+ HASH_FUNCTION_MODULO_N = 'HASH_FUNCTION_MODULO_N',
132
+ HASH_FUNCTION_CLOUD_LOGS = 'HASH_FUNCTION_CLOUD_LOGS',
133
+ }
134
+
135
+ enum EColumnTableEngine {
136
+ COLUMN_ENGINE_NONE = 'COLUMN_ENGINE_NONE',
137
+ COLUMN_ENGINE_REPLACING_TIMESERIES = 'COLUMN_ENGINE_REPLACING_TIMESERIES',
138
+ }