Documentation ¶
Overview ¶
Package testnet helps to manage and control current testnets
Index ¶
- type Adjunct
- type TestNet
- func (tn *TestNet) AddDetails(dd db.DeploymentDetails) error
- func (tn *TestNet) AddNode(node db.Node) *db.Node
- func (tn *TestNet) AddSideCar(node db.SideCar, index int)
- func (tn *TestNet) Destroy() error
- func (tn *TestNet) FinishedBuilding()
- func (tn *TestNet) GetFlatClients() []ssh.Client
- func (tn *TestNet) GetLastestDeploymentDetails() *db.DeploymentDetails
- func (tn *TestNet) GetNodesSideCar(node ssh.Node, name string) (*db.SideCar, error)
- func (tn *TestNet) GetSSHNodes(newNodes bool, sidecar bool, index int) []ssh.Node
- func (tn *TestNet) GetServer(id int) *db.Server
- func (tn *TestNet) PreOrderNewNodes(sidecar bool) map[int][]ssh.Node
- func (tn *TestNet) PreOrderNodes(newNodes bool, sidecar bool, index int) map[int][]ssh.Node
- func (tn *TestNet) SpawnAdjunct(newNodes bool, index int) (*Adjunct, error)
- func (tn *TestNet) Store()
- func (tn *TestNet) StoreNodes() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adjunct ¶ added in v1.7.1
type Adjunct struct { // Testnet is a pointer to the master testnet Main *TestNet Index int Nodes []ssh.Node BuildState *state.BuildState //ptr to the main one LDD *db.DeploymentDetails }
Adjunct represents a part of the network which contains a class of sidecars.
type TestNet ¶
type TestNet struct { TestNetID string // Servers contains the servers on which the testnet resides Servers []db.Server // Nodes contains the active nodes in the network, including the newly built nodes Nodes []db.Node // NewlyBuiltNodes contains only the nodes created in the last/in progress build event NewlyBuiltNodes []db.Node SideCars [][]db.SideCar NewlyBuiltSideCars [][]db.SideCar // Clients is a map of server ids to ssh clients Clients map[int]ssh.Client `json:"-"` // BuildState is the build state for the test net BuildState *state.BuildState `json:"-"` // Details contains all of the past deployments to tn test net Details []db.DeploymentDetails // CombinedDetails contains all of the deployments merged into one CombinedDetails db.DeploymentDetails // LDD is a pointer to latest deployment details LDD *db.DeploymentDetails `json:"-"` // contains filtered or unexported fields }
TestNet represents a testnet and some state on that testnet. Should also contain the details needed to rebuild tn testnet.
func NewTestNet ¶
func NewTestNet(details db.DeploymentDetails, buildID string) (*TestNet, error)
NewTestNet creates a new TestNet
func RestoreTestNet ¶
RestoreTestNet fetches a testnet which already exists.
func (*TestNet) AddDetails ¶
func (tn *TestNet) AddDetails(dd db.DeploymentDetails) error
AddDetails adds the details of a new deployment to the TestNet
func (*TestNet) AddSideCar ¶ added in v1.7.1
AddSideCar adds a side car to the testnet
func (*TestNet) FinishedBuilding ¶
func (tn *TestNet) FinishedBuilding()
FinishedBuilding empties the NewlyBuiltNodes, signals DoneBuilding on the BuildState, and stores the current data of tn testnet
func (*TestNet) GetFlatClients ¶
GetFlatClients takes the clients map and turns it into an array for easy iterator
func (*TestNet) GetLastestDeploymentDetails ¶
func (tn *TestNet) GetLastestDeploymentDetails() *db.DeploymentDetails
GetLastestDeploymentDetails gets a pointer to the latest deployment details
func (*TestNet) GetNodesSideCar ¶ added in v1.7.1
GetNodesSideCar Get's a nodes sidecar by name
func (*TestNet) GetSSHNodes ¶ added in v1.7.1
GetSSHNodes gets all nodes or sidecars wrapper in the ssh Node interface
func (*TestNet) PreOrderNewNodes ¶
PreOrderNewNodes sorts the newly built nodes into buckets by server id
func (*TestNet) PreOrderNodes ¶
PreOrderNodes sorts the nodes into buckets by server id
func (*TestNet) SpawnAdjunct ¶ added in v1.7.1
SpawnAdjunct generates info on an adjunct new by index
func (*TestNet) Store ¶
func (tn *TestNet) Store()
Store stores the TestNets data for later retrieval
func (*TestNet) StoreNodes ¶
StoreNodes stores the newly built nodes into the database with their labels.