Skip to content

threefold.grid4.cloudslices #

fn load #

fn load(path string) ![]Node

load the cloudboxes from a path

fn play #

fn play(mut plbook PlayBook) !map[string]&Node

this play script should never be called from hero directly its called by gridsimulator

fn preprocess_value #

fn preprocess_value(v string) string

struct AIBox #

struct AIBox {
pub mut:
	amount           int
	gpu_brand        string
	gpu_version      string
	description      string
	storage_gb       f64
	passmark         int
	vcores           int
	mem_gb           f64
	mem_gb_gpu       f64
	price_range      []f64 = [0.0, 0.0]
	price_simulation f64
	hdd_nr           int
	ssd_nr           int
}

struct CloudBox #

struct CloudBox {
pub mut:
	amount           int
	description      string
	storage_gb       f64
	passmark         int
	vcores           int
	mem_gb           f64
	price_range      []f64 = [0.0, 0.0]
	price_simulation f64
	ssd_nr           int
}

struct Node #

struct Node {
pub mut:
	id           int
	cost         f64
	deliverytime time.Time
	inca_reward  int
	reputation   int
	uptime       int // 0..100
	cloudbox     []CloudBox
	aibox        []AIBox
	storagebox   []StorageBox
	vendor       string
	grant        NodeGrant
	info         NodeInfo     // Descriptive information about the node
	capacity     NodeCapacity // Hardware capacity details	
}

fn (Node) node_total #

fn (n Node) node_total() NodeTotal

node_total calculates the total values for storage, memory, price simulation, passmark, and vcores by summing up the contributions from different types of boxes.

fn (Node) preprocess_location #

fn (mut n Node) preprocess_location(v string) !

struct NodeCapacity #

struct NodeCapacity {
pub mut:
	storage_gb f64 // Total storage in gigabytes
	mem_gb     f64 // Total memory in gigabytes
	mem_gb_gpu f64 // Total GPU memory in gigabytes
	passmark   int // Passmark score for the node
	vcores     int // Total virtual cores
}

NodeCapacity represents the hardware capacity details of a node.

struct NodeGrant #

struct NodeGrant {
pub mut:
	grant_month_usd   string
	grant_month_inca  string
	grant_max_nrnodes int
}

struct NodeInfo #

struct NodeInfo {
pub mut:
	cpu_brand   string // Brand of the CPU
	cpu_version string // Version of the CPU
	mem         string // Memory specification
	hdd         string // HDD specification
	ssd         string // SSD specification
	url         string // URL for more information
	continent   string // Continent where the node is located
	country     string // Country where the node is located
}

NodeInfo represents the descriptive information about a node.

struct NodeTemplate #

struct NodeTemplate {
	Node
pub mut:
	name        string
	description string // Description of the node
	image_url   string // Image url associated with the node
}

struct NodeTotal #

struct NodeTotal {
pub mut:
	id               int          // Unique identifier for the node
	cost             f64          // Total cost of the node
	deliverytime     time.Time    // Expected delivery time
	inca_reward      int          // Incentive reward for the node
	reputation       int          // Reputation score of the node
	uptime           int          // Uptime percentage
	price_simulation f64          // Simulated price for the node
	info             NodeInfo     // Descriptive information about the node
	capacity         NodeCapacity // Hardware capacity details
}

NodeTotal represents the aggregated data for a node, including hardware specifications, pricing, and location details.

struct StorageBox #

struct StorageBox {
pub mut:
	amount           int
	description      string
	price_range      []f64 = [0.0, 0.0]
	price_simulation f64
}