diff --git a/heromodels/src/models/grid4/specs/model_bid.v b/heromodels/src/models/grid4/specs/model_bid.v index 7bf2a75..0ca7b3f 100644 --- a/heromodels/src/models/grid4/specs/model_bid.v +++ b/heromodels/src/models/grid4/specs/model_bid.v @@ -7,12 +7,16 @@ pub mut: id u32 customer_id u32 // links back to customer for this capacity (user on ledger) compute_slices_nr int // nr of slices I need in 1 machine - compute_slice f64 // price per 1 GB slice I want to accept - storage_slices []u32 + compute_slice_price f64 // price per 1 GB slice I want to accept + storage_slices_nr int + storage_slice_price f64 // price per 1 GB storage slice I want to accept + storage_slices_nr int status BidStatus 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 + signature_user string // signature as done by a user/consumer to validate their identity and intent + billing_period BillingPeriod } pub enum BidStatus { @@ -22,3 +26,12 @@ pub enum BidStatus { cancelled done } + + +pub enum BillingPeriod { + hourly + monthly + yearly + biannually + triannually +} diff --git a/heromodels/src/models/grid4/specs/model_contract.v b/heromodels/src/models/grid4/specs/model_contract.v new file mode 100644 index 0000000..f9fc26b --- /dev/null +++ b/heromodels/src/models/grid4/specs/model_contract.v @@ -0,0 +1,52 @@ +module datamodel + +// I can bid for infra, and optionally get accepted +@[heap] +pub struct Contract { +pub mut: + id u32 + customer_id u32 // links back to customer for this capacity (user on ledger) + compute_slices []ComputeSliceProvisioned + storage_slices []StorageSliceProvisioned + compute_slice_price f64 // price per 1 GB agreed upon + storage_slice_price f64 // price per 1 GB agreed upon + network_slice_price f64 // price per 1 GB agreed upon (transfer) + status ContractStatus + start_date u32 // epoch + end_date u32 + signature_user string // signature as done by a user/consumer to validate their identity and intent + signature_hoster string // signature as done by the hoster + billing_period BillingPeriod +} + +pub enum ConctractStatus { + active + cancelled + error + paused +} + + +// typically 1GB of memory, but can be adjusted based based on size of machine +pub struct ComputeSliceProvisioned { +pub mut: + node_id u32 + id u16 // the id of the slice in the node + mem_gb f64 + storage_gb f64 + passmark int + vcores int + cpu_oversubscription int + tags string +} + +// 1GB of storage +pub struct StorageSliceProvisioned { +pub mut: + node_id u32 + id u16 // the id of the slice in the node, are tracked in the node itself + storage_size_gb int + tags string +} + + diff --git a/heromodels/src/models/grid4/specs/model_node.v b/heromodels/src/models/grid4/specs/model_node.v index d3eca99..b451fa6 100644 --- a/heromodels/src/models/grid4/specs/model_node.v +++ b/heromodels/src/models/grid4/specs/model_node.v @@ -1,5 +1,7 @@ module datamodel +//ACCESS ONLY TF + @[heap] pub struct Node { pub mut: @@ -11,7 +13,7 @@ pub mut: devices DeviceInfo 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 + birthtime u32 // first time node was active 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 @@ -81,29 +83,20 @@ pub mut: // typically 1GB of memory, but can be adjusted based based on size of machine 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 + u16 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 } // 1GB of storage 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 - sla_policy SLAPolicy + u16 int // the id of the slice in the node, are tracked in the node itself } fn (mut n Node) check() ! { diff --git a/heromodels/src/models/grid4/specs/model_nodegroup.v b/heromodels/src/models/grid4/specs/model_nodegroup.v index 57346f4..ae4858b 100644 --- a/heromodels/src/models/grid4/specs/model_nodegroup.v +++ b/heromodels/src/models/grid4/specs/model_nodegroup.v @@ -12,8 +12,7 @@ pub mut: pricingpolicy PricingPolicy compute_slice_normalized_pricing_cc f64 // pricing in CC - cloud credit, per 2GB node slice storage_slice_normalized_pricing_cc f64 // pricing in CC - cloud credit, per 1GB storage slice - reputation int = 50 // between 0 and 100, earned over time - uptime int // between 0 and 100, set by system, farmer has no ability to set this + signature_farmer string // signature as done by farmers to validate that they created this group } pub struct SLAPolicy { @@ -26,5 +25,9 @@ pub mut: pub struct PricingPolicy { pub mut: marketplace_year_discounts []int = [30, 40, 50] // e.g. 30,40,50 means if user has more CC in wallet than 1 year utilization on all his purchaes then this provider gives 30%, 2Y 40%, ... - volume_discounts []int = [10, 20, 30] // e.g. 10,20,30 + // volume_discounts []int = [10, 20, 30] // e.g. 10,20,30 } + + + + diff --git a/heromodels/src/models/grid4/specs/model_reputation.v b/heromodels/src/models/grid4/specs/model_reputation.v new file mode 100644 index 0000000..0d65749 --- /dev/null +++ b/heromodels/src/models/grid4/specs/model_reputation.v @@ -0,0 +1,19 @@ + +@[heap] +pub struct NodeGroupReputation { +pub mut: + nodegroup_id u32 + reputation int = 50 // between 0 and 100, earned over time + uptime int // between 0 and 100, set by system, farmer has no ability to set this + nodes []NodeReputation +} + +pub struct NodeReputation { +pub mut: + node_id u32 + reputation int = 50 // between 0 and 100, earned over time + uptime int // between 0 and 100, set by system, farmer has no ability to set this +} + + + diff --git a/heromodels/src/models/grid4/specs/model_reservation.v b/heromodels/src/models/grid4/specs/model_reservation.v deleted file mode 100644 index 6ba6d5e..0000000 --- a/heromodels/src/models/grid4/specs/model_reservation.v +++ /dev/null @@ -1,21 +0,0 @@ -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 - start_date u32 // epoch - end_date u32 -} - -pub enum ReservationStatus { - pending - confirmed - assigned - cancelled - done -}