package
0.1.1
Repository: https://github.com/threefoldtech/zos4.git
Documentation: pkg.go.dev

# README

Grid Types

Those are types that are used to communicate with a zos node.

Workload

This is the main envelope that hold all reservation information

type Workload struct {
	//Version (optional) is version of reservation object
	Version int `json:"version"`
	// ID of the reservation (filled by the node)
	ID ID `json:"id"`
	// User (required) of the user requesting the reservation
	User ID `json:"user_id"`
	// Type (required) of the reservation (container, zdb, vm, etc...)
	Type WorkloadType `json:"type"`
	// Data (required) is the reservation type arguments. It's different per Type
	Data json.RawMessage `json:"data"`
	// Date of creation (filled by the node)
	Created time.Time `json:"created"`
	//ToDelete is set if the user/farmer asked the reservation to be deleted
	ToDelete bool `json:"to_delete"`
	// Metadata (optional) is custom user metadata
	Metadata string `json:"metadata"`
	//Description (optional)
	Description string `json:"description"`
	// User signature (required)
	Signature string `json:"signature"`
	// Result of reservation (filled by the node)
	Result Result `json:"result"`
}

The signature is filled up by computing a challenge message from the Workload data, then the signature is filled as

signature = hex(ed25591.sign(sk, challenge))

please check the implementation in this package how the challenge is computed from the workload data.

WorkloadType

Data

For each workload type, the Data must be filled with proper parameters for this workload types.

Zmount

check Zmount data here

ZDB

check zdb data here

Network

check network data here

IPV4

check ipv4 data here

Zmachine

check zmachine data here

Kubernetes

check k8s data here

# Packages

No description provided by the author

# Functions

No description provided by the author
IsValidName validates workload name.
Max return max of u, and v.
Min return min of u, and v.
MustMarshal is a utility function to quickly serialize workload data.
MustParseIPNet prases iprange, panics if invalid.
NewIPNet creates a new IPNet from net.IPNet.
No description provided by the author
NewWorkloadID creates a new global ID from it's parts.
Now returns timestamp of now.
ParseIPNet parse iprange.
RegisterSharableType same as RegisterType, but also register this type as sharable, which means this type can be accessed (referenced) from other deploments.
RegisterType register a new workload type.
Types return a list of all registered types.

# Constants

Gigabyte unit multiplier.
Kilobyte unit multiplier.
Megabyte unit multiplier.
No description provided by the author
No description provided by the author
No description provided by the author
SignatureStyleDefault default signature style is done by verifying the signature against the computed ChallengeHash of the deployment.
SignatureStylePolka signature by polka-wallet surrounds the ChallengeHash with <Bytes>$hash</Bytes> tags.
No description provided by the author
No description provided by the author
StateDeleted constant.
StateError constant.
StateInit is the first state of the workload on storage.
StateOk constant.
StatePaused constant.
StateUnChanged is a special error state it means there was an error running the action, but this error did not break previous state.
Terabyte unit multiplier.

# Variables

ErrWorkloadNotFound error.

# Structs

Capacity the expected capacity of a workload.
Deployment structure.
IPNet type.
Result is the struct filled by the node after a reservation object has been processed.
Signature struct.
SignatureRequest struct a signature request of a twin.
SignatureRequirement struct describes the signatures that are needed to be valid for the node to accept the deployment for example SignatureRequirement{ WeightRequired: 1, Requests: []gridtypes.SignatureRequest{ { TwinID: twinID, Weight: 1, }, }, } basically states that a total signature weight of 1 is required for the node to accept the deployment.
No description provided by the author
Workload struct.
WorkloadWithID wrapper around workload type that holds the global workload ID Note: you never need to construct this manually.

# Interfaces

KeyGetter interface to get key by twin ids.
No description provided by the author
No description provided by the author
WorkloadData interface.
WorkloadGetter is used to get a workload by name inside the deployment context.

# Type aliases

DeploymentID is a global unique id for a deployment.
No description provided by the author
No description provided by the author
Name is a type for reservation names.
ResultState type.
SignatureStyle specify the signature style for the signature verification.
No description provided by the author
Timestamp type.
Unit defines a capacity unit in "bytes" Any "value" of type Unit must be in bytes only hence use the Unit mutliplies below to set the write value.
WorkloadID is a global unique id for a workload.
WorkloadType type.