testnet

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: MIT 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 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
	//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) int

AddNode adds a node to the testnet and returns the new nodes absolute number

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) 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() map[int][]db.Node

PreOrderNewNodes sorts the newly built nodes into buckets by server id

func (*TestNet) PreOrderNodes

func (tn *TestNet) PreOrderNodes() map[int][]db.Node

PreOrderNodes sorts the nodes into buckets by server id

func (*TestNet) Store

func (tn *TestNet) Store()

Store stores the TestNets data for later retrieval

func (*TestNet) StoreNodes

func (tn *TestNet) StoreNodes(labels []string) 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