diff options
author | Aleksandr Khoroshilov <hor911@gmail.com> | 2022-05-04 01:42:40 +0300 |
---|---|---|
committer | Aleksandr Khoroshilov <hor911@gmail.com> | 2022-05-04 01:42:40 +0300 |
commit | f23bc0eea02fb852716af5480f7ea5f8ae3a8a99 (patch) | |
tree | 182606fccf8bda16e71530c42c196c84af8044b4 | |
parent | 1b91dd402b95bf9e1306f6361140495f0b932ee1 (diff) | |
download | ydb-f23bc0eea02fb852716af5480f7ea5f8ae3a8a99.tar.gz |
DB schema
ref:559584ecf27ce7d9f4c157b1ff27ab1ad0cef78d
3 files changed, 22 insertions, 0 deletions
diff --git a/ydb/core/yq/libs/control_plane_storage/schema.h b/ydb/core/yq/libs/control_plane_storage/schema.h index 6677be5a30..f4f2fea21c 100644 --- a/ydb/core/yq/libs/control_plane_storage/schema.h +++ b/ydb/core/yq/libs/control_plane_storage/schema.h @@ -11,6 +11,7 @@ namespace NYq { #define IDEMPOTENCY_KEYS_TABLE_NAME "idempotency_keys" #define JOBS_TABLE_NAME "jobs" #define NODES_TABLE_NAME "nodes" +#define QUOTAS_TABLE_NAME "quotas" // columns #define SCOPE_COLUMN_NAME "scope" @@ -69,4 +70,9 @@ namespace NYq { #define ASSIGNED_UNTIL_COLUMN_NAME "assigned_until" #define RETRY_RATE_COLUMN_NAME "retry_rate" +#define SUBJECT_TYPE_COLUMN_NAME "subject_type" +#define SUBJECT_ID_COLUMN_NAME "subject_id" +#define METRIC_NAME_COLUMN_NAME "metric_name" +#define METRIC_VALUE_COLUMN_NAME "metric_value" + } // namespace NYq diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage.cpp b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage.cpp index c1983795b3..b5c14ced33 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage.cpp +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage.cpp @@ -230,6 +230,21 @@ void TYdbControlPlaneStorageActor::CreateResultSetsTable() RunCreateTableActor(tablePath, TTableDescription(description)); } +void TYdbControlPlaneStorageActor::CreateQuotasTable() +{ + auto tablePath = JoinPath(YdbConnection->TablePathPrefix, QUOTAS_TABLE_NAME); + + auto description = TTableBuilder() + .AddNullableColumn(SUBJECT_TYPE_COLUMN_NAME, EPrimitiveType::String) + .AddNullableColumn(SUBJECT_ID_COLUMN_NAME, EPrimitiveType::String) + .AddNullableColumn(METRIC_NAME_COLUMN_NAME, EPrimitiveType::String) + .AddNullableColumn(METRIC_VALUE_COLUMN_NAME, EPrimitiveType::Int64) + .SetPrimaryKeyColumns({SUBJECT_TYPE_COLUMN_NAME, SUBJECT_ID_COLUMN_NAME, METRIC_NAME_COLUMN_NAME}) + .Build(); + + RunCreateTableActor(tablePath, TTableDescription(description)); +} + bool TYdbControlPlaneStorageActor::IsSuperUser(const TString& user) { return AnyOf(Config.Proto.GetSuperUsers(), [&user](const auto& superUser) { diff --git a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h index ac2c03c73e..8a2d404fc9 100644 --- a/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h +++ b/ydb/core/yq/libs/control_plane_storage/ydb_control_plane_storage_impl.h @@ -361,6 +361,7 @@ public: void CreateBindingsTable(); void CreateIdempotencyKeysTable(); void CreateResultSetsTable(); + void CreateQuotasTable(); void RunCreateTableActor(const TString& path, NYdb::NTable::TTableDescription desc); |