models

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

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

Functions

func HostAnsibleIDToCloudID

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

func HostCloudIDToAnsibleID

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

func NewHostConnection

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

Types

type CloudConfig

type CloudConfig map[string]RegionConfig

func (*CloudConfig) GetAllInstanceIDs

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

GetAllInstanceIDs returns all instance IDs

func (*CloudConfig) GetInstanceIDsForRegion

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

GetInstanceIDsForRegion returns instance IDs for specific region

func (*CloudConfig) GetRegions

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

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

type ClusterConfig

type ClusterConfig struct {
	Nodes              []string
	Network            Network
	MonitoringInstance string // instance ID of the separate monitoring instance (if any)
}

type ClustersConfig

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

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

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

type ElasticSubnetConfig

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

type Exportable

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

type GCPConfig

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

type Host

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

func (*Host) Command

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

func (h *Host) Connect() error

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

func (*Host) Connected

func (h *Host) Connected() bool

func (*Host) Disconnect

func (h *Host) Disconnect() error

func (*Host) Download

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

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

Forward forwards the TCP connection to a remote address.

func (*Host) GetAnsibleInventoryRecord

func (h *Host) GetAnsibleInventoryRecord() string

func (*Host) GetCloudID

func (h *Host) GetCloudID() string

GetCloudID returns the node ID of the host.

func (*Host) MkdirAll

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

MkdirAll creates a folder on the remote server.

func (*Host) UntimedForward

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

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

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

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

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

func (*Host) WaitForSSHShell

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
}

func NetworkFromNetworkID

func NetworkFromNetworkID(networkID uint32) Network

func NetworkFromString

func NetworkFromString(s string) Network

func NewDevnetNetwork

func NewDevnetNetwork(ip string, port int) Network

func NewNetwork

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

func (Network) DChainEndpoint

func (n Network) DChainEndpoint() string

func (Network) GenesisParams

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

func (*Network) HandlePublicNetworkSimulation

func (n *Network) HandlePublicNetworkSimulation()

func (Network) Name

func (n Network) Name() string

func (Network) NetworkIDFlagValue

func (n Network) NetworkIDFlagValue() string

type NetworkData

type NetworkData struct {
	SubnetID     ids.ID
	BlockchainID ids.ID
	RPCVersion   int
}

type NetworkKind

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

func (NetworkKind) String

func (nk NetworkKind) String() string

type NodeConfig

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
}

type NodeResult

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

type NodeResults

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

func (*NodeResults) AddResult

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

func (*NodeResults) GetErrorHostMap

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

func (*NodeResults) GetErrorHosts

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

func (*NodeResults) GetNodeList

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

func (*NodeResults) GetResultMap

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

func (*NodeResults) GetResults

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

func (*NodeResults) HasErrors

func (nr *NodeResults) HasErrors() bool

func (*NodeResults) HasNodeIDWithError

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

func (*NodeResults) Len

func (nr *NodeResults) Len() int

type OdygoCompatibility

type OdygoCompatibility map[string][]string

type PermissionlessValidators

type PermissionlessValidators struct {
	TxID ids.ID
}

type RegionConfig

type RegionConfig struct {
	InstanceIDs       []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
	ChainID             string
	Version             string
	Networks            map[string]NetworkData
	ElasticSubnet       map[string]ElasticSubnet
	ImportedFromOPM     bool
	ImportedVMID        string
	CustomVMRepoURL     string
	CustomVMBranch      string
	CustomVMBuildScript string
	// SubnetEVM based VM's only
	SubnetEVMMainnetChainID uint
}

func (Sidecar) GetVMID

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

type VMCompatibility

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

type VMType

type VMType string

func VMTypeFromString

func VMTypeFromString(s string) VMType

func (VMType) RepoName

func (v VMType) RepoName() string

Jump to

Keyboard shortcuts

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