testnet

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testnet helps to manage and control current testnets

Index

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
	// BuildState is the build state for the test net
	BuildState *state.BuildState
	// 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
	// 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

func RestoreTestNet(buildID string) (*TestNet, error)

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) AddNode

func (tn *TestNet) AddNode(node db.Node) *db.Node

AddNode adds a node to the testnet and returns a pointer to that node.

func (*TestNet) AddSideCar added in v1.7.1

func (tn *TestNet) AddSideCar(node db.SideCar, index int)

AddSideCar adds a side car to the testnet

func (*TestNet) Destroy

func (tn *TestNet) Destroy() error

Destroy removes all the testnets data

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

func (tn *TestNet) GetFlatClients() []*ssh.Client

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

func (tn *TestNet) GetNodesSideCar(node ssh.Node, name string) (*db.SideCar, error)

GetNodesSideCar Get's a nodes sidecar by name

func (*TestNet) GetSSHNodes added in v1.7.1

func (tn *TestNet) GetSSHNodes(newNodes bool, sidecar bool, index int) []ssh.Node

GetSSHNodes gets all nodes or sidecars wrapper in the ssh Node interface

func (*TestNet) GetServer

func (tn *TestNet) GetServer(id int) *db.Server

GetServer retrieves a server the TestNet resides on by id

func (*TestNet) PreOrderNewNodes

func (tn *TestNet) PreOrderNewNodes(sidecar bool) map[int][]ssh.Node

PreOrderNewNodes sorts the newly built nodes into buckets by server id

func (*TestNet) PreOrderNodes

func (tn *TestNet) PreOrderNodes(newNodes bool, sidecar bool, index int) map[int][]ssh.Node

PreOrderNodes sorts the nodes into buckets by server id

func (*TestNet) SpawnAdjunct added in v1.7.1

func (tn *TestNet) SpawnAdjunct(newNodes bool, index int) (*Adjunct, error)

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

func (tn *TestNet) StoreNodes() error

StoreNodes stores the newly built nodes into the database with their labels.

Jump to

Keyboard shortcuts

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