models

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause Imports: 22 Imported by: 8

Documentation

Overview

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2023, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Copyright (C) 2022, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

View Source
const (
	SubnetEvm   = "Subnet-EVM"
	BlobVM      = "Blob VM"
	TimestampVM = "Timestamp VM"
	CustomVM    = "Custom"
)

Variables

View Source
var UndefinedNetwork = Network{}

Functions

func HostAnsibleIDToCloudID added in v1.3.4

func HostAnsibleIDToCloudID(hostAnsibleID string) (string, string, error)

HostAnsibleIDToCloudID converts a host Ansible ID to a cloud ID.

func HostCloudIDToAnsibleID added in v1.3.4

func HostCloudIDToAnsibleID(cloudService string, hostCloudID string) (string, error)

func NewHostConnection added in v1.3.4

func NewHostConnection(h *Host, port uint) (*goph.Client, error)

Types

type AvagoCompatiblity added in v1.0.1

type AvagoCompatiblity map[string][]string

type CloudConfig added in v1.3.5

type CloudConfig map[string]RegionConfig

func (*CloudConfig) GetAPIInstanceIDsForRegion added in v1.4.0

func (ccm *CloudConfig) GetAPIInstanceIDsForRegion(region string) []string

GetAPIInstanceIDsForRegion returns API instance IDs for specific region

func (*CloudConfig) GetAllInstanceIDs added in v1.3.5

func (ccm *CloudConfig) GetAllInstanceIDs() []string

GetAllInstanceIDs returns all instance IDs

func (*CloudConfig) GetInstanceIDsForRegion added in v1.3.5

func (ccm *CloudConfig) GetInstanceIDsForRegion(region string) []string

GetInstanceIDsForRegion returns instance IDs for specific region

func (*CloudConfig) GetRegions added in v1.3.5

func (ccm *CloudConfig) GetRegions() []string

GetRegions returns a slice of strings representing the regions of the RegionConfig.

type ClusterConfig added in v1.2.7

type ClusterConfig struct {
	Nodes              []string
	APINodes           []string
	Network            Network
	MonitoringInstance string            // instance ID of the separate monitoring instance (if any)
	LoadTestInstance   map[string]string // maps load test name to load test cloud instance ID of the separate load test instance (if any)
	ExtraNetworkData   ExtraNetworkData
	Subnets            []string
}

func (*ClusterConfig) GetAPIHosts added in v1.4.0

func (cc *ClusterConfig) GetAPIHosts(hosts []*Host) []*Host

GetAPINodes returns a filtered list of API nodes based on the ClusterConfig and given hosts.

func (*ClusterConfig) GetCloudIDs added in v1.5.0

func (cc *ClusterConfig) GetCloudIDs() []string

func (*ClusterConfig) GetHostRoles added in v1.5.0

func (cc *ClusterConfig) GetHostRoles(nodeConf NodeConfig) []string

func (*ClusterConfig) GetValidatorHosts added in v1.4.0

func (cc *ClusterConfig) GetValidatorHosts(hosts []*Host) []*Host

GetValidatorNodes returns the validator nodes from the ClusterConfig.

func (*ClusterConfig) IsAPIHost added in v1.5.0

func (cc *ClusterConfig) IsAPIHost(hostCloudID string) bool

func (*ClusterConfig) IsAvalancheGoHost added in v1.5.0

func (cc *ClusterConfig) IsAvalancheGoHost(hostCloudID string) bool

type ClustersConfig added in v1.3.4

type ClustersConfig struct {
	Version   string
	KeyPair   map[string]string        // maps key pair name to cert path
	Clusters  map[string]ClusterConfig // maps clusterName to nodeID list + network kind
	GCPConfig GCPConfig                // stores GCP project name and filepath to service account JSON key
}

type ClustersConfigV0 added in v1.3.4

type ClustersConfigV0 struct {
	KeyPair   map[string]string   // maps key pair name to cert path
	Clusters  map[string][]string // maps clusterName to nodeID list
	GCPConfig GCPConfig           // stores GCP project name and filepath to service account JSON key
}

type ElasticSubnet added in v1.2.0

type ElasticSubnet struct {
	SubnetID    ids.ID
	AssetID     ids.ID
	PChainTXID  ids.ID
	TokenName   string
	TokenSymbol string
	Validators  map[string]PermissionlessValidators
	Txs         map[string]ids.ID
}

type ElasticSubnetConfig added in v1.2.0

type ElasticSubnetConfig struct {
	SubnetID                 ids.ID
	AssetID                  ids.ID
	InitialSupply            uint64
	MaxSupply                uint64
	MinConsumptionRate       uint64
	MaxConsumptionRate       uint64
	MinValidatorStake        uint64
	MaxValidatorStake        uint64
	MinStakeDuration         time.Duration
	MaxStakeDuration         time.Duration
	MinDelegationFee         uint32
	MinDelegatorStake        uint64
	MaxValidatorWeightFactor byte
	UptimeRequirement        uint32
}

type Exportable added in v0.2.0

type Exportable struct {
	Sidecar         Sidecar
	Genesis         []byte
	ChainConfig     []byte
	SubnetConfig    []byte
	NetworkUpgrades []byte
	NodeConfig      []byte
}

type ExtraNetworkData added in v1.5.0

type ExtraNetworkData struct {
	CChainTeleporterMessengerAddress string
	CChainTeleporterRegistryAddress  string
}

type GCPConfig added in v1.3.3

type GCPConfig struct {
	ProjectName        string // name of GCP Project
	ServiceAccFilePath string // location of GCP service account key file path
}

type Host added in v1.3.3

type Host struct {
	NodeID            string
	IP                string
	SSHUser           string
	SSHPrivateKeyPath string
	SSHCommonArgs     string
	Connection        *goph.Client
}

func (*Host) Command added in v1.3.4

func (h *Host) Command(script string, env []string, timeout time.Duration) ([]byte, error)

Command executes a shell command on a remote host.

func (*Host) Connect added in v1.3.4

func (h *Host) Connect(port uint) error

Connect starts a new SSH connection with the provided private key.

func (*Host) Connected added in v1.3.4

func (h *Host) Connected() bool

func (*Host) Disconnect added in v1.3.4

func (h *Host) Disconnect() error

func (*Host) Download added in v1.3.4

func (h *Host) Download(remoteFile string, localFile string, timeout time.Duration) error

Download downloads a file from the remote server to the local machine.

func (*Host) Forward added in v1.3.4

func (h *Host) Forward(httpRequest string, timeout time.Duration) ([]byte, error)

Forward forwards the TCP connection to a remote address.

func (*Host) GetAnsibleInventoryRecord added in v1.3.3

func (h *Host) GetAnsibleInventoryRecord() string

func (*Host) GetCloudID added in v1.3.4

func (h *Host) GetCloudID() string

GetCloudID returns the node ID of the host.

func (*Host) MkdirAll added in v1.3.4

func (h *Host) MkdirAll(remoteDir string, timeout time.Duration) error

MkdirAll creates a folder on the remote server.

func (*Host) StreamSSHCommand added in v1.5.0

func (h *Host) StreamSSHCommand(command string, env []string, timeout time.Duration) error

StreamSSHCommand streams the execution of an SSH command on the host.

func (*Host) UntimedForward added in v1.3.4

func (h *Host) UntimedForward(httpRequest string) ([]byte, error)

UntimedForward forwards the TCP connection to a remote address. Does not support timeouts on the operation.

func (*Host) UntimedMkdirAll added in v1.3.4

func (h *Host) UntimedMkdirAll(remoteDir string) error

UntimedMkdirAll creates a folder on the remote server. Does not support timeouts on the operation.

func (*Host) Upload added in v1.3.4

func (h *Host) Upload(localFile string, remoteFile string, timeout time.Duration) error

Upload uploads a local file to a remote file on the host.

func (*Host) WaitForSSHPort added in v1.3.4

func (h *Host) WaitForSSHPort(port uint, timeout time.Duration) error

WaitForSSHPort waits for the SSH port to become available on the host.

func (*Host) WaitForSSHShell added in v1.3.4

func (h *Host) WaitForSSHShell(timeout time.Duration) error

WaitForSSHShell waits for the SSH shell to be available on the host within the specified timeout.

type Network

type Network struct {
	Kind        NetworkKind
	ID          uint32
	Endpoint    string
	ClusterName string
}

func NetworkFromNetworkID added in v1.0.0

func NetworkFromNetworkID(networkID uint32) Network

func NewDevnetNetwork added in v1.3.4

func NewDevnetNetwork(endpoint string, id uint32) Network

func NewFujiNetwork added in v1.5.0

func NewFujiNetwork() Network

func NewLocalNetwork added in v1.5.0

func NewLocalNetwork() Network

func NewMainnetNetwork added in v1.5.0

func NewMainnetNetwork() Network

func NewNetwork added in v1.3.4

func NewNetwork(kind NetworkKind, id uint32, endpoint string, clusterName string) Network

func NewNetworkFromCluster added in v1.5.0

func NewNetworkFromCluster(n Network, clusterName string) Network

func (Network) BlockchainEndpoint added in v1.4.0

func (n Network) BlockchainEndpoint(blockchainID string) string

func (Network) BlockchainWSEndpoint added in v1.4.0

func (n Network) BlockchainWSEndpoint(blockchainID string) string

func (Network) CChainEndpoint added in v1.3.4

func (n Network) CChainEndpoint() string

func (Network) CChainWSEndpoint added in v1.4.0

func (n Network) CChainWSEndpoint() string

func (Network) GenesisParams added in v1.3.5

func (n Network) GenesisParams() *genesis.Params

func (*Network) HandlePublicNetworkSimulation added in v1.3.5

func (n *Network) HandlePublicNetworkSimulation()

func (Network) Name added in v1.3.4

func (n Network) Name() string

func (Network) NetworkIDFlagValue added in v1.3.4

func (n Network) NetworkIDFlagValue() string

type NetworkData added in v0.2.0

type NetworkData struct {
	SubnetID                    ids.ID
	TransferSubnetOwnershipTxID ids.ID
	BlockchainID                ids.ID
	RPCVersion                  int
	TeleporterMessengerAddress  string
	TeleporterRegistryAddress   string
}

type NetworkKind added in v1.3.4

type NetworkKind int64
const (
	Undefined NetworkKind = iota
	Mainnet
	Fuji
	Local
	Devnet
)

func (NetworkKind) String added in v1.3.4

func (nk NetworkKind) String() string

type NodeConfig added in v1.2.7

type NodeConfig struct {
	NodeID        string // instance id on cloud server
	Region        string // region where cloud server instance is deployed
	AMI           string // image id for cloud server dependent on its os (e.g. ubuntu )and region deployed (e.g. us-east-1)
	KeyPair       string // key pair name used on cloud server
	CertPath      string // where the cert is stored in user's local machine ssh directory
	SecurityGroup string // security group used on cloud server
	ElasticIP     string // public IP address of the cloud server
	CloudService  string // which cloud service node is hosted on (AWS / GCP)
	UseStaticIP   bool   // node has a static IP association
	IsMonitor     bool   // node has a monitoring dashboard
	IsAWMRelayer  bool   // node has an AWM relayer service
	IsLoadTest    bool   // node is used to host load test
}

type NodeResult added in v1.3.4

type NodeResult struct {
	NodeID string
	Value  interface{}
	Err    error
}

type NodeResults added in v1.3.4

type NodeResults struct {
	Results []NodeResult
	Lock    sync.Mutex
}

func (*NodeResults) AddResult added in v1.3.4

func (nr *NodeResults) AddResult(nodeID string, value interface{}, err error)

func (*NodeResults) GetErrorHostMap added in v1.3.4

func (nr *NodeResults) GetErrorHostMap() map[string]error

func (*NodeResults) GetErrorHosts added in v1.3.4

func (nr *NodeResults) GetErrorHosts() []string

func (*NodeResults) GetNodeList added in v1.3.4

func (nr *NodeResults) GetNodeList() []string

func (*NodeResults) GetResultMap added in v1.3.4

func (nr *NodeResults) GetResultMap() map[string]interface{}

func (*NodeResults) GetResults added in v1.3.4

func (nr *NodeResults) GetResults() []NodeResult

func (*NodeResults) HasErrors added in v1.3.4

func (nr *NodeResults) HasErrors() bool

func (*NodeResults) HasNodeIDWithError added in v1.3.4

func (nr *NodeResults) HasNodeIDWithError(nodeID string) bool

func (*NodeResults) Len added in v1.3.4

func (nr *NodeResults) Len() int

type PermissionlessValidators added in v1.2.1

type PermissionlessValidators struct {
	TxID ids.ID
}

type RegionConfig added in v1.3.5

type RegionConfig struct {
	InstanceIDs       []string
	APIInstanceIDs    []string
	PublicIPs         []string
	KeyPair           string
	SecurityGroup     string
	CertFilePath      string
	ImageID           string
	Prefix            string
	CertName          string
	SecurityGroupName string
	NumNodes          int
	InstanceType      string
}

type Sidecar

type Sidecar struct {
	Name                string
	VM                  VMType
	VMVersion           string
	RPCVersion          int
	Subnet              string
	TokenName           string
	TokenSymbol         string
	ChainID             string
	Version             string
	Networks            map[string]NetworkData
	ElasticSubnet       map[string]ElasticSubnet
	ImportedFromAPM     bool
	ImportedVMID        string
	CustomVMRepoURL     string
	CustomVMBranch      string
	CustomVMBuildScript string
	// Teleporter related
	TeleporterReady   bool
	TeleporterKey     string
	TeleporterVersion string
	RunRelayer        bool
	// SubnetEVM based VM's only
	SubnetEVMMainnetChainID uint
}

func (Sidecar) GetVMID added in v1.1.0

func (sc Sidecar) GetVMID() (string, error)

type VMCompatibility added in v1.0.1

type VMCompatibility struct {
	RPCChainVMProtocolVersion map[string]int `json:"rpcChainVMProtocolVersion"`
}

type VMType added in v0.1.3

type VMType string

func VMTypeFromString added in v0.1.3

func VMTypeFromString(s string) VMType

func (VMType) RepoName added in v1.1.0

func (v VMType) RepoName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL