Documentation
¶
Index ¶
- Constants
- Variables
- type Address
- type Boot
- type BootType
- type BrokenDevice
- type BrokenPool
- type Container
- type ContainerID
- type ContainerModule
- type ContainerNetworkConfig
- type ContractCancelledEvent
- type ContractLockedEvent
- type Counters
- type Device
- type DeviceType
- type DiskIOCountersStat
- type DisksIOCountersStat
- type ErrInvalidDeviceType
- type ErrNotEnoughSpace
- type ExitDevice
- type FarmID
- type Flister
- type GPUInfo
- type Gateway
- type GatewayMetrics
- type HostMonitor
- type Identifier
- type IdentityManager
- type IfaceType
- type Interface
- type Interfaces
- type KernelArgs
- type MachineInfo
- type MachineMetric
- type MachineMetrics
- type MountInfo
- type MountOptions
- type NetID
- type NetMetric
- type NetResourceMetrics
- type NetlinkAddress
- type NetlinkAddresses
- type Network
- type NetworkInfo
- type Networker
- type NetworkerLight
- type NicIOCounterStat
- type NicsIOCounterStat
- type NodeFeature
- type OptionPublicConfig
- type PerformanceMonitor
- type PlanetaryTap
- type PoolMetrics
- type PoolStats
- type PoolsStats
- type PowerTargetChangeEvent
- type Provision
- type PublicConfig
- type PublicConfigEvent
- type QSFSD
- type QSFSInfo
- type QSFSMetrics
- type Registrar
- type RootFSPropagation
- type Route
- type SharedDir
- type Statistics
- type Stats
- type StorageModule
- type StrIdentifier
- type Stream
- type SubstrateError
- type SubstrateGateway
- type SystemCall
- type SystemMonitor
- type SystemOS
- type SystemOSMock
- func (os *SystemOSMock) Create(path string) (io.ReadCloser, error)
- func (os *SystemOSMock) IsNotExist(err error) bool
- func (os *SystemOSMock) Mkdir(path string, perm fs.FileMode) error
- func (os *SystemOSMock) MkdirAll(path string, perm fs.FileMode) error
- func (os *SystemOSMock) Mount(source string, target string, fstype string, flags uintptr, data string) error
- func (os *SystemOSMock) RemoveAll(path string) error
- func (os *SystemOSMock) Stat(path string) (fs.FileInfo, error)
- type TapDevice
- type TaskResult
- type TimesStat
- type Usage
- type UsersCounters
- type VDisk
- type VM
- type VMDisk
- type VMIface
- type VMInfo
- type VMModule
- type VMNetworkInfo
- type VersionMonitor
- type VirtualMemoryStat
- type Volume
- type ZUI
Constants ¶
const ( CodeGenericError = iota - 1 CodeNoError CodeNotFound CodeBurnTransactionNotFound CodeRefundTransactionNotFound CodeFailedToDecode CodeInvalidVersion CodeUnknownVersion CodeIsUsurped CodeAccountNotFound CodeDepositFeeNotFound CodeMintTransactionNotFound )
const ( RootFSPropagationSlave = "slave" RootFSPropagationRslave = "rslave" RootFSPropagationPrivate = "private" RootFSPropagationRprivate = "rprivate" )
Variables ¶
var ( //DefaultMountOptions has sane values for mount DefaultMountOptions = MountOptions{ ReadOnly: false, Limit: 256 * gridtypes.Megabyte, } //ReadOnlyMountOptions shortcut for readonly mount options ReadOnlyMountOptions = MountOptions{ ReadOnly: true, } )
var DefaultSysCall = &defaultSysCall{}
var DefaultSystemOS = &defaultFileSystem{}
instance of default filesystem
Functions ¶
This section is empty.
Types ¶
type BrokenDevice ¶
type BrokenDevice struct {
// Path to allow identification of the disk
Path string
// Err returned which lead to the disk being marked as faulty
Err error
}
BrokenDevice is a disk which is somehow not fully functional. Storage keeps track of disks which have failed at some point, so they are not used, and to be able to later report this to other daemons.
type BrokenPool ¶
type BrokenPool struct {
// Label of the broken pool
Label string
// Err returned by the action which let to the pool being marked as broken
Err error
}
BrokenPool contains info about a malfunctioning storage pool
type Container ¶
type Container struct {
// Name of container
Name string
// path to the rootfs of the container
RootFS string
// Env env variables to container in format {'KEY=VALUE', 'KEY2=VALUE2'}
Env []string
// WorkingDir of the entrypoint command
WorkingDir string
// Network network info for container
Network NetworkInfo
// Mounts extra mounts for container
Mounts []MountInfo
// Entrypoint the process to start inside the container
Entrypoint string
// Interactivity enable Core X as PID 1 on the container
Interactive bool
// CPU count limit
CPU uint
// Memory limit in
Memory gridtypes.Unit
// Logs backends
Logs []logger.Logs
// Stats container metrics backend
Stats []Stats
// Elevated privileges (to use fuse inside)
Elevated bool
// CreatedAt time
CreatedAt time.Time
// RootfsPropagation root fs propagation mode (rshared,shared,slave,...)
RootFsPropagation RootFSPropagation
// How much time to wait for the container to gracefully shutdown before sending a SIGKILL (default: 5)
ShutdownTimeout time.Duration
}
Container creation info
type ContainerModule ¶
type ContainerModule interface {
// Run creates and starts a container on the node. It also auto
// starts command defined by `entrypoint` inside the container
// ns: tenant namespace
// data: Container info
Run(ns string, data Container) (ContainerID, error)
// Exec executes a command in the container
// stdout and stderr is ignored
Exec(ns string, containerID string, timeout time.Duration, args ...string) error
// ListNS list the name of all the container namespaces
ListNS() ([]string, error)
// List all the existing container IDs from a certain namespace ns
// if ns is empty, then the container IDs from all existing namespaces will be return
List(ns string) ([]ContainerID, error)
// Inspect, return information about the container, given its container id
Inspect(ns string, id ContainerID) (Container, error)
SignalDelete(ns string, id ContainerID) error
Delete(ns string, id ContainerID) error
// Get logs of the container
Logs(ns string, containerID string) (logs string, err error)
}
ContainerModule defines rpc interface to containerd
type ContainerNetworkConfig ¶
ContainerNetworkConfig defines how to construct the network namespace of a container
type ContractCancelledEvent ¶
ContractCancelledEvent a contract has been cancelled, The type specify if this is just notification of the reconnection, or actual event has been received.
type ContractLockedEvent ¶
ContractLockedEvent is raised when a contract is locked/unlocked. On locking the Lock flag will be set to true. If Kind is EventSubscribed it means event stream has been reconnected and might be events loss. It's up to the handler of this event type to make sure contracts are synched with the grid.
type Counters ¶
type Counters struct {
// Total system capacity
Total gridtypes.Capacity `json:"total"`
// Used capacity this include user + system resources
Used gridtypes.Capacity `json:"used"`
// System resource reserved by zos
System gridtypes.Capacity `json:"system"`
// Users statistics by zos
Users UsersCounters `json:"users"`
// OpenConnecions number of open connections in the node
OpenConnecions int `json:"open_connections"`
}
type DeviceType ¶
type DeviceType = zos.DeviceType
DeviceType is the actual type of hardware that the storage device runs on, i.e. SSD or HDD
type DiskIOCountersStat ¶
type DiskIOCountersStat struct {
disk.IOCountersStat
Time time.Time
}
DiskIOCountersStat struct
func (*DiskIOCountersStat) String ¶
func (s *DiskIOCountersStat) String() string
type DisksIOCountersStat ¶
type DisksIOCountersStat map[string]DiskIOCountersStat
DisksIOCountersStat alias for map[string]IOCountersStat required by zbus
type ErrInvalidDeviceType ¶
type ErrInvalidDeviceType struct {
DeviceType DeviceType
}
ErrInvalidDeviceType raised when trying to allocate space on unsupported device type
func (ErrInvalidDeviceType) Error ¶
func (e ErrInvalidDeviceType) Error() string
type ErrNotEnoughSpace ¶
type ErrNotEnoughSpace struct {
DeviceType DeviceType
}
ErrNotEnoughSpace indicates that there is not enough space in a pool of the requested type to create the filesystem
func (ErrNotEnoughSpace) Error ¶
func (e ErrNotEnoughSpace) Error() string
type ExitDevice ¶
type ExitDevice struct {
// IsSingle is set to true if br-pub
// is connected to zos bridge
IsSingle bool `json:"is_single"`
// IsDual is set to true if br-pub is
// connected to a physical nic
IsDual bool `json:"is_dual"`
// AsDualInterface is set to the physical
// interface name if IsDual is true
AsDualInterface string `json:"dual_interface"`
}
func (*ExitDevice) String ¶
func (e *ExitDevice) String() string
type Flister ¶
type Flister interface {
// Mount mounts an flist located at url using the 0-db located at storage
// in a RO mode. note that there is no way u can unmount a ro flist because
// it can be shared by many users, it's then up to system to decide if the
// mount is not needed anymore and clean it up
Mount(name, url string, opt MountOptions) (path string, err error)
// UpdateMountSize change the mount size
UpdateMountSize(name string, limit gridtypes.Unit) (path string, err error)
// Umount a RW mount. this only unmounts the RW layer and remove the assigned
// volume.
Unmount(name string) error
// HashFromRootPath returns flist hash from a running g8ufs mounted with NamedMount
HashFromRootPath(name string) (string, error)
// FlistHash returns md5 of flist if available (requesting the hub)
FlistHash(url string) (string, error)
Exists(name string) (bool, error)
}
Flister is the interface for the flist module
type Gateway ¶
type Gateway interface {
SetNamedProxy(wlID string, config zos.GatewayNameProxy) (string, error)
SetFQDNProxy(wlID string, config zos.GatewayFQDNProxy) error
DeleteNamedProxy(wlID string) error
Metrics() (GatewayMetrics, error)
}
type GatewayMetrics ¶
func (*GatewayMetrics) Nu ¶
func (m *GatewayMetrics) Nu(service string) (result uint64)
type HostMonitor ¶
HostMonitor interface (provided by noded)
type Identifier ¶
type Identifier interface {
Identity() string
}
Identifier is the interface that defines how an object can be used as an identity
type IdentityManager ¶
type IdentityManager interface {
// Store returns the key store kind
StoreKind() string
// NodeID returns the node id (public key)
NodeID() StrIdentifier
// Address return the node address (SS58Address address)
Address() (Address, error)
// FarmID return the farm id this node is part of. this is usually a configuration
// that the node is booted with. An error is returned if the farmer id is not configured
FarmID() (FarmID, error)
// Farm returns name of the farm. Or error
Farm() (string, error)
//FarmSecret get the farm secret as defined in the boot params
FarmSecret() (string, error)
// Sign signs the message with privateKey and returns a signature.
Sign(message []byte) ([]byte, error)
// Verify reports whether sig is a valid signature of message by publicKey.
Verify(message, sig []byte) error
// Encrypt encrypts message with the public key of the node
Encrypt(message []byte) ([]byte, error)
// Decrypt decrypts message with the private of the node
Decrypt(message []byte) ([]byte, error)
// EncryptECDH aes encrypt msg using a shared key derived from private key of the node and public key of the other party using Elliptic curve Diffie Helman algorithm
// the nonce if prepended to the encrypted message
EncryptECDH(msg []byte, publicKey []byte) ([]byte, error)
// DecryptECDH decrypt aes encrypted msg using a shared key derived from private key of the node and public key of the other party using Elliptic curve Diffie Helman algorithm
DecryptECDH(msg []byte, publicKey []byte) ([]byte, error)
// PrivateKey sends the keypair
PrivateKey() []byte
}
IdentityManager interface.
type Interfaces ¶
Interfaces struct to bypass zbus generation error where it generate a stub with map as interface instead of map
type KernelArgs ¶
KernelArgs are arguments passed to the kernel
func (KernelArgs) Extend ¶
func (s KernelArgs) Extend(k KernelArgs)
Extend the arguments with set of extra arguments
type MachineInfo ¶
type MachineInfo struct {
ConsoleURL string
}
type MachineMetric ¶
MachineMetric is a container for metrics from multiple networks currently only grouped as private (wireguard + yggdrasil), and public (public Ips)
type MachineMetrics ¶
type MachineMetrics map[string]MachineMetric
MachineMetrics container for metrics from multiple machines
type MountInfo ¶
type MountInfo struct {
Source string // source of the mount point on the host
Target string // target of mount inside the container
}
MountInfo defines a mount point
type MountOptions ¶
type MountOptions struct {
// ReadOnly
ReadOnly bool
// Limit size of read-write layer
Limit gridtypes.Unit
// optional storage url (default to hub storage)
Storage string
// PersistedVolume used in RW mode. If not provided
// one that will be created automatically with `Limit` that uses the same mount
// name, and will be delete (by name) on Unmount. If provided, make sure
// use use a different name than the mount id, or it will also get deleted
// on unmount.
PersistedVolume string
}
MountOptions struct
type NetMetric ¶
type NetMetric struct {
NetRxPackets uint64 `json:"net_rx_packets"`
NetRxBytes uint64 `json:"net_rx_bytes"`
NetTxPackets uint64 `json:"net_tx_packets"`
NetTxBytes uint64 `json:"net_tx_bytes"`
}
NetMetric aggregated metrics from a single network
type NetResourceMetrics ¶
type NetlinkAddresses ¶
NetlinkAddresses alias for [][]NetlinkAddress
type NetworkInfo ¶
type NetworkInfo struct {
// Containers don't need to know about anything about bridges,
// IPs, wireguards since this is all is only known by the network
// resource which is out of the scope of this module
Namespace string
}
NetworkInfo defines a network configuration for a container
type Networker ¶
type Networker interface {
// Ready return nil is networkd is ready to operate
// This function is used by other deamon to test if networkd is done booting
Ready() error
// Create a new network resource
CreateNR(wl gridtypes.WorkloadID, network Network) (string, error)
// Delete a network resource
DeleteNR(wl gridtypes.WorkloadID) error
// Namespace returns the namespace name for given netid.
// it doesn't check if network exists.
Namespace(id zos.NetID) string
// EnsureZDBPrepare ensures a network namespace is created with a macvlan
// interface into it to allow the 0-db container to be publicly accessible
// it returns the name of the network namespace created
// id is the zdb id (should be unique) is used to drive the hw mac
// address for the interface so they always get the same IP
EnsureZDBPrepare(id string) (string, error)
// ZDBDestroy is the opposite of ZDPrepare, it makes sure network setup done
// for zdb is rewind. ns param is the namespace return by the ZDBPrepare
ZDBDestroy(ns string) error
// MigrateZdbMacvlanToVeth migrate the zdb setup to use veth instead of macvlan
MigrateZdbMacvlanToVeth() error
// QSFSNamespace returns the namespace of the qsfs workload
QSFSNamespace(id string) string
// QSFSYggIP returns the ygg ip of the qsfs workload
QSFSYggIP(id string) (string, error)
// QSFSPrepare creates a network namespace with a macvlan interface into it
// to allow qsfs container to reach the internet but not be reachable itself
// it return the name of the network namespace created, and the ygg ip.
// the id should be unique.
QSFSPrepare(id string) (string, string, error)
// QSFSDestroy rewind setup by QSFSPrepare
QSFSDestroy(id string) error
// SetupPrivTap sets up a tap device in the network namespace for the networkID. It is hooked
// to the network bridge. The name of the tap interface is returned
SetupPrivTap(networkID NetID, name string) (tap string, err error)
// SetupMyceliumTap creates a new mycelium tap device attached to this network resource with deterministic IP address
SetupMyceliumTap(name string, netID zos.NetID, config zos.MyceliumIP) (PlanetaryTap, error)
// SetupYggTap sets up a tap device in the host namespace for the yggdrasil ip
SetupYggTap(name string) (PlanetaryTap, error)
// TapExists checks if the tap device with the given name exists already
TapExists(name string) (bool, error)
// RemoveTap removes the tap device with the given name
RemoveTap(name string) error
// PublicIPv4Support enabled on this node for reservations
PublicIPv4Support() bool
// SetupPubTap sets up a tap device in the host namespace for the public ip
// reservation id. It is hooked to the public bridge. The name of the tap
// interface is returned
SetupPubTap(name string) (string, error)
// PubTapExists checks if the tap device for the public network exists already
PubTapExists(name string) (bool, error)
// RemovePubTap removes the public tap device from the host namespace
RemovePubTap(name string) error
// SetupPubIPFilter sets up filter for this public ip
SetupPubIPFilter(filterName string, iface string, ipv4 net.IP, ipv6 net.IP, mac string) error
// RemovePubIPFilter removes the filter setted up by SetupPubIPFilter
RemovePubIPFilter(filterName string) error
// PubIPFilterExists checks if there is a filter installed with that name
PubIPFilterExists(filterName string) bool
// DisconnectPubTap disconnects the public tap from the network. The interface
// itself is not removed and will need to be cleaned up later
DisconnectPubTap(name string) error
// GetSubnet of the network with the given ID on the local node
GetSubnet(networkID NetID) (net.IPNet, error)
// GetNet returns the full network range of the network
GetNet(networkID NetID) (net.IPNet, error)
// GetPublicIPv6Subnet returns the IPv6 prefix op the public subnet of the host
GetPublicIPv6Subnet() (net.IPNet, error)
// GetPublicIPV6Gateway gets the gateway for public IPv6 that can be used
// by the VMs
GetPublicIPV6Gateway() (net.IP, error)
// GetDefaultGwIP returns the IPs of the default gateways inside the network
// resource identified by the network ID on the local node, for IPv4 and IPv6
// respectively
GetDefaultGwIP(networkID NetID) (net.IP, net.IP, error)
// GetIPv6From4 generates an IPv6 address from a given IPv4 address in a NR
GetIPv6From4(networkID NetID, ip net.IP) (net.IPNet, error)
// Addrs return the IP addresses of interface
// if the interface is in a network namespace netns needs to be not empty
// if iface is empty, return ALL interfaces in the given namespace
// if they are physical
Interfaces(iface string, netns string) (Interfaces, error)
// Addrs return the IP addresses of interface
// if the interface is in a network namespace netns needs to be not empty
// [obsolete] please use Interfaces instead
Addrs(iface string, netns string) (ips []net.IP, mac string, err error)
WireguardPorts() ([]uint, error)
// Set node public namespace config.
SetPublicConfig(cfg PublicConfig) error
// UnsetPublicConfig removes public config from node
UnsetPublicConfig() error
// Get node public namespace config
GetPublicConfig() (PublicConfig, error)
// GetPublicExitDevice either return "singe" or "dual(<nic>)"
GetPublicExitDevice() (ExitDevice, error)
SetPublicExitDevice(iface string) error
Metrics() (NetResourceMetrics, error)
// ZOSAddresses monitoring streams for ZOS bridge IPs
ZOSAddresses(ctx context.Context) <-chan NetlinkAddresses
// DMZAddresses monitoring streams for dmz public interface
DMZAddresses(ctx context.Context) <-chan NetlinkAddresses
// YggAddresses monitoring streams for yggdrasil interface
YggAddresses(ctx context.Context) <-chan NetlinkAddresses
PublicAddresses(ctx context.Context) <-chan OptionPublicConfig
}
Networker is the interface for the network module
type NetworkerLight ¶
type NetworkerLight interface {
// Create(name string, net zos.NetworkLight, seed []byte) error
Create(name string, wl gridtypes.WorkloadID, net zos.NetworkLight) error
Delete(name string) error
AttachPrivate(name, id string, vmIp net.IP) (device TapDevice, err error)
AttachMycelium(name, id string, seed []byte) (device TapDevice, err error)
Detach(id string) error
Interfaces(iface string, netns string) (Interfaces, error)
AttachZDB(id string) (string, error)
ZDBIPs(namespace string) ([]net.IP, error)
Namespace(id string) string
Ready() error
ZOSAddresses(ctx context.Context) <-chan NetlinkAddresses
SetPublicConfig(cfg PublicConfig) error
UnSetPublicConfig() error
LoadPublicConfig() (PublicConfig, error)
WireguardPorts() ([]uint, error)
GetDefaultGwIP(id NetID) (net.IP, error)
GetNet(id NetID) (net.IPNet, error)
GetSubnet(id NetID) (net.IPNet, error)
}
NetworkerLight is the interface for the network light module
type NicIOCounterStat ¶
type NicIOCounterStat struct {
net.IOCountersStat
RateOut uint64
RateIn uint64
}
NicIOCounterStat counter for a nic
type NicsIOCounterStat ¶
type NicsIOCounterStat []NicIOCounterStat
NicsIOCounterStat alias for []NicIOCounterStat
type NodeFeature ¶
type NodeFeature string
Types of workloads can be deployed depending on the network manager running on the node
type OptionPublicConfig ¶
type OptionPublicConfig struct {
PublicConfig
HasPublicConfig bool
}
type PerformanceMonitor ¶
type PerformanceMonitor interface {
Get(taskName string) (TaskResult, error)
GetAll() ([]TaskResult, error)
}
type PlanetaryTap ¶
PlanetaryTap structure
type PoolMetrics ¶
type PoolStats ¶
type PoolStats struct {
disk.UsageStat
// Counters IO counter for each pool device
Counters map[string]disk.IOCountersStat `json:"counters"`
}
PoolStats is pool statistics reported by storaged
type PowerTargetChangeEvent ¶
type Provision ¶
type Provision interface {
DecommissionCached(id string, reason string) error
// GetWorkloadStatus: returns status, bool(true if workload exits otherwise it is false), error
GetWorkloadStatus(id string) (gridtypes.ResultState, bool, error)
CreateOrUpdate(twin uint32, deployment gridtypes.Deployment, update bool) error
Get(twin uint32, contractID uint64) (gridtypes.Deployment, error)
List(twin uint32) ([]gridtypes.Deployment, error)
Changes(twin uint32, contractID uint64) ([]gridtypes.Workload, error)
ListPublicIPs() ([]string, error)
ListPrivateIPs(twin uint32, network gridtypes.Name) ([]string, error)
}
Provision interface
type PublicConfig ¶
type PublicConfig struct {
// Type define if we need to use
// the Vlan field or the MacVlan
Type IfaceType `json:"type"`
IPv4 gridtypes.IPNet `json:"ipv4"`
IPv6 gridtypes.IPNet `json:"ipv6"`
GW4 net.IP `json:"gw4"`
GW6 net.IP `json:"gw6"`
// Domain is the node domain name like gent01.devnet.grid.tf
// or similar
Domain string `json:"domain"`
}
PublicConfig is the configuration of the interface that is connected to the public internet
func PublicConfigFrom ¶
func PublicConfigFrom(cfg substrate.PublicConfig) (pub PublicConfig, err error)
func (PublicConfig) Equal ¶
func (p PublicConfig) Equal(cfg PublicConfig) bool
func (*PublicConfig) IsEmpty ¶
func (p *PublicConfig) IsEmpty() bool
type PublicConfigEvent ¶
type PublicConfigEvent struct {
PublicConfig substrate.OptionPublicConfig
}
PublicConfigEvent pubic config event received. The type specify if this is just notification of the reconnection, or actual event has been received.
type QSFSD ¶
type QSFSD interface {
Mount(wlID string, cfg zos.QuantumSafeFS) (QSFSInfo, error)
UpdateMount(wlID string, cfg zos.QuantumSafeFS) (QSFSInfo, error)
SignalDelete(wlID string) error
Metrics() (QSFSMetrics, error)
}
type QSFSMetrics ¶
func (*QSFSMetrics) Nu ¶
func (q *QSFSMetrics) Nu(wlID string) (result uint64)
type RootFSPropagation ¶
type RootFSPropagation string
RootFSPropagation defines how the submounts are propagated to its mountpoint peers
type Route ¶
type Route struct {
Net net.IPNet
// Gateway can be nil, in that
// case the device is used as a dev instead
Gateway net.IP
}
Route structure
type Statistics ¶
type Stats ¶
type Stats struct {
Type string `bson:"type" json:"type"`
Endpoint string `bson:"endpoint" json:"endpoint"`
}
Stats endpoints
type StorageModule ¶
type StorageModule interface {
// Cache method return information about zos cache volume
Cache() (Volume, error)
// Total gives the total amount of storage available for a device type
Total(kind DeviceType) (uint64, error)
// BrokenPools lists the broken storage pools that have been detected
BrokenPools() []BrokenPool
// BrokenDevices lists the broken devices that have been detected
BrokenDevices() []BrokenDevice
//Monitor returns stats stream about pools
Monitor(ctx context.Context) <-chan PoolsStats
// VolumeCreate creates a new volume
VolumeCreate(name string, size gridtypes.Unit) (Volume, error)
// VolumeUpdate updates the size of an existing volume
VolumeUpdate(name string, size gridtypes.Unit) error
// VolumeLookup return volume information for given name
VolumeLookup(name string) (Volume, error)
// VolumeExists checks if a volume exists and returns error if the lookup failed
VolumeExists(name string) (bool, error)
// VolumeDelete deletes a volume by name
VolumeDelete(name string) error
// VolumeList list all volumes
VolumeList() ([]Volume, error)
// DiskCreate creates a virtual disk given name and size
DiskCreate(name string, size gridtypes.Unit) (VDisk, error)
// DiskResize resizes the disk to given size
DiskResize(name string, size gridtypes.Unit) (VDisk, error)
// DiskWrite writes the given raw image to disk
DiskWrite(name string, image string) error
// DiskFormat makes sure disk has filesystem, if it already formatted nothing happens
DiskFormat(name string) error
// DiskLookup looks up vdisk by name
DiskLookup(name string) (VDisk, error)
// DiskExists checks if disk exists
DiskExists(name string) bool
// DiskDelete deletes a disk
DiskDelete(name string) error
DiskList() ([]VDisk, error)
//Devices list all "allocated" devices
Devices() ([]Device, error)
// DeviceAllocate allocates a new device (formats and give a new ID)
DeviceAllocate(min gridtypes.Unit) (Device, error)
// DeviceLookup inspects a previously allocated device
DeviceLookup(name string) (Device, error)
// Capacity
Metrics() ([]PoolMetrics, error)
}
StorageModule is the storage subsystem interface this should allow you to work with the following types of storage medium - full disks (device) (these are used by zdb) - subvolumes these are used as a read-write layers for 0-fs mounts - vdisks are used by zmachines this works as following: a storage module maintains a list of ALL disks on the system separated in 2 sets of pools (SSDs, and HDDs) ssd pools can only be used for - subvolumes - vdisks hdd pools are only used by zdb as one disk
type StrIdentifier ¶
type StrIdentifier string
StrIdentifier is a helper type that implement the Identifier interface on top of simple string
func (StrIdentifier) Identity ¶
func (s StrIdentifier) Identity() string
Identity implements the Identifier interface
type Stream ¶
type SubstrateError ¶
func (*SubstrateError) IsCode ¶
func (e *SubstrateError) IsCode(codes ...int) bool
func (*SubstrateError) IsError ¶
func (e *SubstrateError) IsError() bool
type SubstrateGateway ¶
type SubstrateGateway interface {
CreateNode(node substrate.Node) (uint32, error)
CreateTwin(relay string, pk []byte) (uint32, error)
EnsureAccount(activationURL []string, termsAndConditionsLink string, termsAndConditionsHash string) (info substrate.AccountInfo, err error)
GetContract(id uint64) (substrate.Contract, SubstrateError)
GetContractIDByNameRegistration(name string) (uint64, SubstrateError)
GetFarm(id uint32) (substrate.Farm, error)
GetNode(id uint32) (substrate.Node, error)
GetNodeByTwinID(twin uint32) (uint32, SubstrateError)
GetNodeContracts(node uint32) ([]types.U64, error)
GetNodeRentContract(node uint32) (uint64, SubstrateError)
GetNodes(farmID uint32) ([]uint32, error)
GetPowerTarget(nodeID uint32) (power substrate.NodePower, err error)
GetTwin(id uint32) (substrate.Twin, error)
GetTwinByPubKey(pk []byte) (uint32, SubstrateError)
Report(consumptions []substrate.NruConsumption) (types.Hash, error)
SetContractConsumption(resources ...substrate.ContractResources) error
SetNodePowerState(up bool) (hash types.Hash, err error)
UpdateNode(node substrate.Node) (uint32, error)
UpdateNodeUptimeV2(uptime uint64, timestampHint uint64) (hash types.Hash, err error)
GetTime() (time.Time, error)
GetZosVersion() (string, error)
}
type SystemCall ¶
type SystemMonitor ¶
type SystemMonitor interface {
NodeID() uint32
Memory(ctx context.Context) <-chan VirtualMemoryStat
CPU(ctx context.Context) <-chan TimesStat
Disks(ctx context.Context) <-chan DisksIOCountersStat
Nics(ctx context.Context) <-chan NicsIOCounterStat
GetNodeFeatures() []NodeFeature
}
SystemMonitor interface (provided by noded)
type SystemOS ¶
type SystemOS interface {
Create(string) (io.ReadCloser, error)
MkdirAll(string, fs.FileMode) error
Mkdir(string, fs.FileMode) error
Stat(string) (fs.FileInfo, error)
RemoveAll(string) error
IsNotExist(error) bool
}
SystemOS interface to mock actual OS operations.
type SystemOSMock ¶
SystemOSMock used to mock the filesystem object
func (*SystemOSMock) Create ¶
func (os *SystemOSMock) Create(path string) (io.ReadCloser, error)
func (*SystemOSMock) IsNotExist ¶
func (os *SystemOSMock) IsNotExist(err error) bool
func (*SystemOSMock) MkdirAll ¶
func (os *SystemOSMock) MkdirAll(path string, perm fs.FileMode) error
func (*SystemOSMock) RemoveAll ¶
func (os *SystemOSMock) RemoveAll(path string) error
type TaskResult ¶
type TaskResult struct {
Name string `json:"name"`
Description string `json:"description"`
Timestamp uint64 `json:"timestamp"`
Result interface{} `json:"result"`
}
TaskResult the result test schema
type UsersCounters ¶
type UsersCounters struct {
// Total deployments count
Deployments int `json:"deployments"`
// Total workloads count
Workloads int `json:"workloads"`
// Last deployment timestamp
LastDeploymentTimestamp gridtypes.Timestamp `json:"last_deployment_timestamp"`
}
UsersCounters the expected counters for deployments and workloads
type VM ¶
type VM struct {
// virtual machine name, or ID
Name string
// CPU is number of cores assigned to the VM
CPU uint8
// Memory size
Memory gridtypes.Unit
// Network is network info
Network VMNetworkInfo
// KernelImage path to uncompressed linux kernel ELF
KernelImage string
// InitrdImage (optional) path to initrd disk
InitrdImage string
// KernelArgs to override the default kernel arguments. (default: "ro console=ttyS0 noapic reboot=k panic=1 pci=off nomodules")
KernelArgs KernelArgs
// Entrypoint a shell-compatible command to execute as the init process
Entrypoint string
// Disks are a list of disks that are going to
// be auto allocated on the provided storage path
Disks []VMDisk
Shared []SharedDir
// Boot options
Boot Boot
// Environment is injected to the VM via container mechanism (virtiofs)
// otherwise it's added to the kernel arguments
Environment map[string]string
// If this flag is set, the VM module will not auto start
// this machine hence, also no auto clean up when it exits
// it's up to the caller to check for the machine status
// and do clean up (module.Delete(vm)) when needed
NoKeepAlive bool
// Hostname for the vm
Hostname string
// extra PCI devices to be attached to
// the virtual machine the strings
// has to be a valid pci bus ids
// in the format 0000:01:00.0
Devices []string
}
VM config structure
type VMDisk ¶
type VMDisk struct {
// Path raw disk path
Path string
// Target is mount point. Only in container mode
Target string
}
VMDisk specifies vm disk params
type VMIface ¶
type VMIface struct {
// Tap device name
Tap string
// Mac address of the device
MAC string
// ips assigned to this interface
IPs []net.IPNet
// extra routes on this interface
Routes []Route
// IP4DefaultGateway address for ipv4
IP4DefaultGateway net.IP
// IP6DefaultGateway address for ipv6
IP6DefaultGateway net.IP
// PublicIPv4 holds a public IPv4
PublicIPv4 bool
// PublicIPv4 holds a public Ipv6
PublicIPv6 bool
// NetId holds network id (for private network only)
NetID zos.NetID
}
VMIface structure
type VMInfo ¶
type VMInfo struct {
// Flag for enabling/disabling Hyperthreading
// Required: true
HtEnabled bool
// Memory size of VM
// Required: true
Memory int64
// Number of vCPUs (either 1 or an even number)
CPU int64
}
VMInfo returned by the inspect method
type VMModule ¶
type VMModule interface {
Run(vm VM) (MachineInfo, error)
Inspect(name string) (VMInfo, error)
Delete(name string) error
Exists(name string) bool
Logs(name string) (string, error)
List() ([]string, error)
Metrics() (MachineMetrics, error)
// Lock set lock on VM (pause,resume)
Lock(name string, lock bool) error
// StreamCreate creates a stream for vm `name`
StreamCreate(name string, stream Stream) error
// delete stream by stream id.
StreamDelete(id string) error
}
VMModule defines the virtual machine module interface
type VMNetworkInfo ¶
type VMNetworkInfo struct {
// Interfaces for the vm network
Ifaces []VMIface
// Nameservers dns servers
Nameservers []net.IP
}
VMNetworkInfo structure
type VersionMonitor ¶
type VersionMonitor interface {
GetVersion() semver.Version
Version(ctx context.Context) <-chan semver.Version
}
VersionMonitor interface (provided by identityd)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
store
Key store implements different methods of storing the node identity seed on disk
|
Key store implements different methods of storing the node identity seed on disk |
|
Package diagnostics is a generated GoMock package.
|
Package diagnostics is a generated GoMock package. |
|
netbase
|
|
|
options
Package options abstract setting common networking sys flags on the selected namespaces
|
Package options abstract setting common networking sys flags on the selected namespaces |
|
options
Package options abstract setting common networking sys flags on the selected namespaces
|
Package options abstract setting common networking sys flags on the selected namespaces |
|
Package provision exposes the Engine type.
|
Package provision exposes the Engine type. |
|
common
Package common hold logic that is used by both the provision and primitive package it purpose is mainly to avoid circular dependencies
|
Package common hold logic that is used by both the provision and primitive package it purpose is mainly to avoid circular dependencies |
|
* rotate package provides a very simple tool to truncate a given file to 0 after it copies the last *configurable* part of this file to a new file with suffix .tail
|
* rotate package provides a very simple tool to truncate a given file to 0 after it copies the last *configurable* part of this file to a new file with suffix .tail |
|
Package zdb implements a client to 0-db: https://github.com/threefoldtech/0-DB
|
Package zdb implements a client to 0-db: https://github.com/threefoldtech/0-DB |
|
Package zinit exposes function to interat with zinit service life cyle management
|
Package zinit exposes function to interat with zinit service life cyle management |