status

package
v1.7.5 Latest Latest
Warning

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

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

Documentation

Overview

Package status handles functions related to the current state of the network

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBuildStatus

func CheckBuildStatus(buildID string) (string, error)

CheckBuildStatus checks the current status of the build relating to the given build id

func FindNodeIndex

func FindNodeIndex(status []NodeStatus, name string, serverID int) int

FindNodeIndex finds the index of a node by name and server id

func GetClient

func GetClient(id int) (*ssh.Client, error)

GetClient retrieves the ssh client for running a command on a remote server based on server id. It will create one if it does not exist.

func GetClients

func GetClients(servers []int) ([]*ssh.Client, error)

GetClients functions similar to GetClient, except that it takes in an array of server ids and outputs an array of clients

func GetClientsFromNodes

func GetClientsFromNodes(nodes []db.Node) ([]*ssh.Client, error)

GetClientsFromNodes gets all of the ssh clients you need for communication with the given nodes

func GetLatestServers

func GetLatestServers(testnetID string) ([]db.Server, error)

GetLatestServers gets the servers used in the latest testnet, populated with the ips of all the nodes

Types

type Comp

type Comp struct {
	CPU float64 `json:"cpu"`
	VSZ float64 `json:"virtualMemorySize"`
	RSS float64 `json:"residentSetSize"`
}

Comp represents the compuational resources currently in use by a node

func SumResUsage

func SumResUsage(c *ssh.Client, name string) (Comp, error)

SumResUsage gets the cpu usage of a node

type NodeStatus

type NodeStatus struct {
	Name      string `json:"name"`
	Server    int    `json:"server"`
	IP        string `json:"ip"`
	Up        bool   `json:"up"`
	Resources Comp   `json:"resourceUse"`
	ID        string `json:"id"`
}

NodeStatus represents the status of the node

func CheckNodeStatus

func CheckNodeStatus(nodes []db.Node) ([]NodeStatus, error)

CheckNodeStatus checks the status of the nodes in the current testnet

Jump to

Keyboard shortcuts

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