Skip to content

Commit

Permalink
fix: fix types in TTenant
Browse files Browse the repository at this point in the history
  • Loading branch information
krosy1337 committed Oct 3, 2023
1 parent e54973a commit 3f65477
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/store/reducers/tenants/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ export const calculateTenantMetrics = (tenant?: TTenant) => {
StorageAllocatedSize,
CoresLimit,
MemoryLimit,
StorageLimit,
StorageAllocatedLimit,
Metrics = {},
DatabaseQuotas = {},
} = tenant || {};

const cpuFromCores = isNumeric(CoresUsed) ? Number(CoresUsed) * 1_000_000 : undefined;
Expand All @@ -46,9 +47,11 @@ export const calculateTenantMetrics = (tenant?: TTenant) => {
const tableStorage = isNumeric(Metrics.Storage) ? Number(Metrics.Storage) : undefined;
const cpuLimit = isNumeric(CoresLimit) ? Number(CoresLimit) : undefined;
const memoryLimit = isNumeric(MemoryLimit) ? Number(MemoryLimit) : undefined;
const blobStorageLimit = isNumeric(StorageLimit) ? Number(StorageLimit) : undefined;
const tableStorageLimit = isNumeric(Metrics.StorageLimit)
? Number(Metrics.StorageLimit)
const blobStorageLimit = isNumeric(StorageAllocatedLimit)
? Number(StorageAllocatedLimit)
: undefined;
const tableStorageLimit = isNumeric(DatabaseQuotas.data_size_hard_quota)
? Number(DatabaseQuotas.data_size_hard_quota)
: undefined;

return {
Expand Down
17 changes: 16 additions & 1 deletion src/types/api/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export interface TTenant {
ControlPlane?: ControlPlane; // additional

CoresLimit?: string; // TODO: check correctness in backend protos when fully supported
StorageLimit?: string; // TODO: check correctness in backend protos when fully supported
/** uint64 */
StorageAllocatedLimit?: string;
DatabaseQuotas?: DatabaseQuotas;
}

interface THiveDomainStatsStateCount {
Expand Down Expand Up @@ -149,3 +151,16 @@ export enum ETabletVolatileState {
'TABLET_VOLATILE_STATE_STARTING' = 'TABLET_VOLATILE_STATE_STARTING',
'TABLET_VOLATILE_STATE_RUNNING' = 'TABLET_VOLATILE_STATE_RUNNING',
}

interface DatabaseQuotas {
/** uint64 */
data_size_hard_quota?: string;
/** uint64 */
data_size_soft_quota?: string;
/** uint64 */
data_stream_shards_quota?: string;
/** uint64 */
data_stream_reserved_storage_quota?: string;
/** uint32 */
ttl_min_run_internal_seconds?: string;
}

0 comments on commit 3f65477

Please sign in to comment.