From b168d647da8a4e70e31c2f1f9d61a502380f8b35 Mon Sep 17 00:00:00 2001 From: despiegk Date: Thu, 21 Aug 2025 17:18:41 +0200 Subject: [PATCH] ... --- lib/threefold/grid4/datamodel/model_node.v | 3 +++ .../grid4/datamodel/model_reservation.v | 22 +++++++++++++++++++ .../grid4/datamodel/model_slice_compute.v | 22 +++++++++++++++++++ .../grid4/datamodel/model_slice_storage.v | 16 ++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 lib/threefold/grid4/datamodel/model_reservation.v create mode 100644 lib/threefold/grid4/datamodel/model_slice_compute.v create mode 100644 lib/threefold/grid4/datamodel/model_slice_storage.v diff --git a/lib/threefold/grid4/datamodel/model_node.v b/lib/threefold/grid4/datamodel/model_node.v index c2e1eaf5..8d2a5e18 100644 --- a/lib/threefold/grid4/datamodel/model_node.v +++ b/lib/threefold/grid4/datamodel/model_node.v @@ -12,6 +12,9 @@ pub mut: country string // 2 letter code as specified in lib/data/countries/data/countryInfo.txt, use that library for validation capacity NodeCapacity // Hardware capacity details provisiontime u32 // lets keep it simple and compatible + pubkey string + signature_node string //signature done on node to validate pubkey with privkey + signature_farmer string //signature as done by farmers to validate their identity } pub struct DeviceInfo { diff --git a/lib/threefold/grid4/datamodel/model_reservation.v b/lib/threefold/grid4/datamodel/model_reservation.v new file mode 100644 index 00000000..85639d9c --- /dev/null +++ b/lib/threefold/grid4/datamodel/model_reservation.v @@ -0,0 +1,22 @@ +module datamodel + +@[heap] +pub struct Reservation { +pub mut: + id u32 + customer_id u32 //links back to customer for this capacity + compute_slices []u32 + storage_slices []u32 + status ReservationStatus + obligation bool //if obligation then will be charged and money needs to be in escrow, otherwise its an intent + start_date u32 //epoch + end_date u32 +} + +pub enum ReservationStatus { + pending + confirmed + assigned + cancelled + done +} \ No newline at end of file diff --git a/lib/threefold/grid4/datamodel/model_slice_compute.v b/lib/threefold/grid4/datamodel/model_slice_compute.v new file mode 100644 index 00000000..b407ecec --- /dev/null +++ b/lib/threefold/grid4/datamodel/model_slice_compute.v @@ -0,0 +1,22 @@ +module datamodel + + + +// typically 1GB of memory, but can be adjusted based based on size of machine +@[heap] +pub struct ComputeSlice { +pub mut: + nodeid u32 // the node in the grid, there is an object describing the node + id int // the id of the slice in the node + mem_gb f64 + storage_gb f64 + passmark int + vcores int + cpu_oversubscription int + storage_oversubscription int + price_range []f64 = [0.0, 0.0] + gpus u8 // nr of GPU's see node to know what GPU's are + price_cc f64 // price per slice (even if the grouped one) + pricing_policy PricingPolicy + sla_policy SLAPolicy +} diff --git a/lib/threefold/grid4/datamodel/model_slice_storage.v b/lib/threefold/grid4/datamodel/model_slice_storage.v new file mode 100644 index 00000000..24a1d00e --- /dev/null +++ b/lib/threefold/grid4/datamodel/model_slice_storage.v @@ -0,0 +1,16 @@ +module datamodel + + +// 1GB of storage +@[heap] +pub struct StorageSlice { +pub mut: + nodeid u32 // the node in the grid + id int // the id of the slice in the node, are tracked in the node itself + price_cc f64 // price per slice (even if the grouped one) + pricing_policy PricingPolicy //copied from node which is part of nodegroup + sla_policy SLAPolicy +} + + +