node_manager

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DOCKER_COMPOSE_DIR = "docker-compose"
View Source
const NODES_FILENAME = "nodes.json"
View Source
const SSH_PRIVATE_KEY_DIR = "ssh-private-keys"

Variables

This section is empty.

Functions

func CreateDirIfNotExists

func CreateDirIfNotExists(dirname string) error

func GetDockerComposeDir

func GetDockerComposeDir() string

func GetNodesListFile

func GetNodesListFile() string

func GetSSHKeyPath

func GetSSHKeyPath(nodeId string) string

func GetSshKeysDir

func GetSshKeysDir() string

func GetWorkDir

func GetWorkDir() string

func Install

func Install(node Node, isDockerComposePresent bool)

func RemoveNode

func RemoveNode(nodeId string) error

func RemoveSshKeyIfExist

func RemoveSshKeyIfExist(nodeId string) error

func UpdateSshKeyName

func UpdateSshKeyName(oldNodeId string, newNodeId string) error

func WriteNodeList

func WriteNodeList(nodes []Node) error

Types

type Config

type Config struct {
	BlockReward             *string `json:"block_reward"`
	DeltaF0                 *uint   `json:"delta_f0"`
	EndTimeStamp            *uint   `json:"end_timestamp"`
	GenesisTimestamp        *uint   `json:"genesis_timestamp"`
	OperationValidityParios *uint   `json:"operation_validity_periods"`
	PeriodsPerCycle         *uint   `json:"periods_per_cycle"`
	PosLockCycles           *uint   `json:"pos_lock_cycles"`
	PosLookbackCycle        *uint   `json:"pos_lookback_cycles"`
	RollPrice               *string `json:"roll_price"`
	T0                      *uint   `json:"t0"`
	ThreadCount             *uint   `json:"thread_count"`
}

type ConsensusStats

type ConsensusStats struct {
	CliqueCount         *uint `json:"clique_count"`
	EndTimespan         *uint `json:"end_timespan"`
	FinalBlockCount     *uint `json:"final_block_count"`
	FinalOperationCount *uint `json:"final_operation_count"`
	StakerCount         *uint `json:"staker_count"`
	StaleBlockCount     *uint `json:"stale_block_count"`
	StartTimespan       *uint `json:"start_timespan"`
}

type ExecutionStats

type ExecutionStats struct {
	TimeWindowStart              *uint      `json:"time_window_start"`
	TimeWindowEnd                *uint      `json:"time_window_end"`
	FinalBlockCount              *uint      `json:"final_block_count"`
	FinalExecutedOperationsCount *uint      `json:"final_executed_operations_count"`
	ActiveCurser                 *node.Slot `json:"active_cursor"`
}

type InstallNodeInput

type InstallNodeInput struct {
	Id                string                `form:"id" binding:"required"`
	Username          string                `form:"username" binding:"required"`
	Host              string                `form:"host" binding:"required"`
	DiscordId         string                `form:"discord-id"`
	WalletPassword    string                `form:"wallet-password" binding:"required"`
	SshPassword       string                `form:"ssh-password"`
	SshKeyFile        *multipart.FileHeader `form:"file"`
	DockerComposeFile *multipart.FileHeader `form:"docker-compose"`
}

func (*InstallNodeInput) CreateNode

func (input *InstallNodeInput) CreateNode() Node

type ManageNodeInput

type ManageNodeInput struct {
	Id string `json:"id" binding:"required"`
}

type NetworkStats

type NetworkStats struct {
	ActiveNodeCount    *uint `json:"active_node_count"`
	BannedPeerCount    *uint `json:"banned_peer_count"`
	InConnectionCount  *uint `json:"in_connection_count"`
	KnowPeerCount      *uint `json:"known_peer_count"`
	OutConnectionCount *uint `json:"out_connection_count"`
}

type Node

type Node struct {
	Id             string
	Username       string
	Host           string
	DiscordId      string
	WalletPassword string
	SshPassword    string
	Status         NodeStatus
}

func GetNodeById

func GetNodeById(id string) (*Node, error)

func GetNodes

func GetNodes() ([]Node, error)

func (*Node) BackupWallet

func (node *Node) BackupWallet() (string, error)

func (*Node) DownloadFileSSH

func (node *Node) DownloadFileSSH(remote string, local string) error

func (*Node) FetchStatus

func (node *Node) FetchStatus() (NodeStatus, State)

func (*Node) GetDockerComposePath

func (node *Node) GetDockerComposePath() string

func (*Node) GetLogs

func (node *Node) GetLogs() (string, error)

func (*Node) GetStatus

func (node *Node) GetStatus() NodeStatus

func (*Node) GetSystemMetrics

func (node *Node) GetSystemMetrics() (*SystemMetrics, error)

func (*Node) SetStatus

func (node *Node) SetStatus(newState NodeStatus)

func (*Node) StartNode

func (node *Node) StartNode() (string, error)

func (*Node) StopNode

func (node *Node) StopNode() (string, error)

func (*Node) WalletInfo

func (node *Node) WalletInfo() (*WalletInfo, error)

type NodeStatus

type NodeStatus int
const (
	Unknown NodeStatus = iota
	Up
	Down
	Installing
	Bootstrapping
)

func (NodeStatus) String

func (i NodeStatus) String() string

type State

type State struct {
	Config         *Config         `json:"config"`
	ConsensusStats *ConsensusStats `json:"consensus_stats"`
	CurrentCycle   *uint           `json:"current_cycle"`
	CurrentTime    *uint           `json:"current_time"`
	ExecutionStats *ExecutionStats `json:"execution_stats"`
	LastSlot       *node.Slot      `json:"last_slot"`
	NetworkStats   *NetworkStats   `json:"network_stats"`
	NextSlot       *node.Slot      `json:"next_slot"`
	NodeID         *string         `json:"node_id"`
	NodeIP         *string         `json:"node_ip"`
	PoolStats      *[]uint         `json:"pool_stats"`
	Version        *string         `json:"version"`
}

type SystemMetrics

type SystemMetrics struct {
	CPU  float64
	RAM  float64
	Disk int
}

type WalletInfo

type WalletInfo struct {
	Address           string
	Thread            float64
	Candidate_rolls   float64
	Final_rolls       float64
	Active_rolls      float64
	Final_balance     string
	Candidate_balance string
}

Jump to

Keyboard shortcuts

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