From 684b5b511acc2f71fb1262b180dc6b144ff4882e Mon Sep 17 00:00:00 2001 From: kogeletey Date: Sun, 8 Sep 2024 21:09:48 +0300 Subject: [PATCH] feat: supported simple deployments and worker node types --- entities/deployment.d.ts | 14 ++++++++++++-- entities/index.ts | 1 + entities/provider.d.ts | 14 ++------------ entities/unit.d.ts | 13 +++++++++++++ entities/worker.d.ts | 11 +++++++++++ 5 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 entities/unit.d.ts create mode 100644 entities/worker.d.ts diff --git a/entities/deployment.d.ts b/entities/deployment.d.ts index 94128b9..4b1cd7b 100644 --- a/entities/deployment.d.ts +++ b/entities/deployment.d.ts @@ -1,9 +1,19 @@ import type { Compose } from "./compose.d.ts" +import type { Unit } from "./unit.d.ts" -type Spec = string | Compose +type Spec = string | Compose | Simple + +type Simple = { + container: string + cpu?: Unit + ram?: Unit + name?: string + envs?: string[] + volumes?: string[] +} export type Deployment = { - kind: string + kind: "compose" | "simple" | "deployment" spec: Spec promocode?: string } diff --git a/entities/index.ts b/entities/index.ts index 1f8238e..fce8673 100644 --- a/entities/index.ts +++ b/entities/index.ts @@ -2,3 +2,4 @@ export * from "./account.d.ts" export * from "./compose.d.ts" export * from "./provider.d.ts" export * from "./deployment.d.ts" +export * from "./worked.d.ts" diff --git a/entities/provider.d.ts b/entities/provider.d.ts index 14fcee2..72e8f65 100644 --- a/entities/provider.d.ts +++ b/entities/provider.d.ts @@ -1,3 +1,5 @@ +import type { Unit } from "./unit.d.ts" + export type Provider = { uuid: string name: string @@ -8,18 +10,6 @@ export type Provider = { address: string } -type Unit = { - unit: string - count: number -} - -type ComputingUnit = { - cpu: number | Unit - mem: number | Unit - persistence: number | Unit - bandwitch: number | Unit -} - type PriceTable = { [x: string]: ComputingUnit | Unit } diff --git a/entities/unit.d.ts b/entities/unit.d.ts new file mode 100644 index 0000000..f2b7a34 --- /dev/null +++ b/entities/unit.d.ts @@ -0,0 +1,13 @@ +export type Unit = { + unit: string + count: number +} + +export type ComputingUnit = { + cpu: number | Unit + mem: number | Unit + persistence: number | Unit + bandwitch: number | Unit +} + + diff --git a/entities/worker.d.ts b/entities/worker.d.ts new file mode 100644 index 0000000..9cc2ac4 --- /dev/null +++ b/entities/worker.d.ts @@ -0,0 +1,11 @@ +import type { ComputingUnit } from "./unit.d.ts" + +export type Worker = { + uuid: string + /* address for receive payments */ + address?: string + name?: string + price?: ComputingUnit + /* address to node server */ + node?: string +}