Documentation ¶
Overview ¶
Package state for grid state
Package state for grid state
Index ¶
- Variables
- type ContractIDs
- type Network
- type NetworkState
- type State
- func (st *State) AssignNodesIPRange(k *workloads.K8sCluster) (err error)
- func (st *State) GetWorkloadInDeployment(ctx context.Context, nodeID uint32, name string, deploymentName string) (gridtypes.Workload, gridtypes.Deployment, error)
- func (st *State) LoadDeploymentFromGrid(ctx context.Context, nodeID uint32, name string) (workloads.Deployment, error)
- func (st *State) LoadDiskFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.Disk, error)
- func (st *State) LoadGatewayFQDNFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.GatewayFQDNProxy, error)
- func (st *State) LoadGatewayNameFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.GatewayNameProxy, error)
- func (st *State) LoadK8sFromGrid(ctx context.Context, nodeIDs []uint32, deploymentName string) (workloads.K8sCluster, error)
- func (st *State) LoadNetworkFromGrid(ctx context.Context, name string) (znet workloads.ZNet, err error)
- func (st *State) LoadQSFSFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.QSFS, error)
- func (st *State) LoadVMFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.VM, error)
- func (st *State) LoadZdbFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.ZDB, error)
- func (st *State) RemoveContractIDs(nodeID uint32, contractIDs ...uint64)
- func (st *State) StoreContractIDs(nodeID uint32, contractIDs ...uint64)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound for state not found instances
Functions ¶
This section is empty.
Types ¶
type Network ¶
Network struct includes Subnets and node IPs
func (*Network) GetNodeSubnet ¶
GetNodeSubnet gets a node subnet using its ID
func (*Network) SetNodeSubnet ¶
SetNodeSubnet sets a node subnet with its ID and subnet
type NetworkState ¶
NetworkState is a struct of networks names and their networks and mutex to protect the state
func (*NetworkState) DeleteNetwork ¶
func (nm *NetworkState) DeleteNetwork(networkName string)
DeleteNetwork deletes a Network using its name
func (*NetworkState) GetNetwork ¶
func (nm *NetworkState) GetNetwork(networkName string) Network
GetNetwork get a Network using its name
func (*NetworkState) UpdateNetworkSubnets ¶
func (nm *NetworkState) UpdateNetworkSubnets(networkName string, ipRange map[uint32]gridtypes.IPNet)
UpdateNetworkSubnets updates a network subnets given its name
type State ¶
type State struct { CurrentNodeDeployments map[uint32]ContractIDs Networks NetworkState NcPool client.NodeClientGetter Substrate subi.SubstrateExt }
State struct
func NewState ¶
func NewState(ncPool client.NodeClientGetter, substrate subi.SubstrateExt) *State
NewState generates a new state
func (*State) AssignNodesIPRange ¶
func (st *State) AssignNodesIPRange(k *workloads.K8sCluster) (err error)
AssignNodesIPRange to assign ip range of k8s cluster nodes
func (*State) GetWorkloadInDeployment ¶
func (st *State) GetWorkloadInDeployment(ctx context.Context, nodeID uint32, name string, deploymentName string) (gridtypes.Workload, gridtypes.Deployment, error)
GetWorkloadInDeployment return a workload in a deployment using their names and node ID if name is empty it returns a deployment with name equal to deploymentName and empty workload
func (*State) LoadDeploymentFromGrid ¶
func (st *State) LoadDeploymentFromGrid(ctx context.Context, nodeID uint32, name string) (workloads.Deployment, error)
LoadDeploymentFromGrid loads deployment from grid
func (*State) LoadDiskFromGrid ¶
func (st *State) LoadDiskFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.Disk, error)
LoadDiskFromGrid loads a disk from grid
func (*State) LoadGatewayFQDNFromGrid ¶
func (st *State) LoadGatewayFQDNFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.GatewayFQDNProxy, error)
LoadGatewayFQDNFromGrid loads a gateway FQDN proxy from grid
func (*State) LoadGatewayNameFromGrid ¶
func (st *State) LoadGatewayNameFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.GatewayNameProxy, error)
LoadGatewayNameFromGrid loads a gateway name proxy from grid
func (*State) LoadK8sFromGrid ¶
func (st *State) LoadK8sFromGrid(ctx context.Context, nodeIDs []uint32, deploymentName string) (workloads.K8sCluster, error)
LoadK8sFromGrid loads k8s from grid
func (*State) LoadNetworkFromGrid ¶
func (st *State) LoadNetworkFromGrid(ctx context.Context, name string) (znet workloads.ZNet, err error)
LoadNetworkFromGrid loads a network from grid
func (*State) LoadQSFSFromGrid ¶
func (st *State) LoadQSFSFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.QSFS, error)
LoadQSFSFromGrid loads a QSFS from grid
func (*State) LoadVMFromGrid ¶
func (st *State) LoadVMFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.VM, error)
LoadVMFromGrid loads a vm from a grid
func (*State) LoadZdbFromGrid ¶
func (st *State) LoadZdbFromGrid(ctx context.Context, nodeID uint32, name string, deploymentName string) (workloads.ZDB, error)
LoadZdbFromGrid loads a zdb from grid