node

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package node provides an easy way to access node related information.

Utility functions to generate names and directory paths encapsulate the package conventions. It is highly recommended to use this package when implementing a new package to achieve consistency across packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {

	// The global ID of this node
	ID string `json:"id"`

	// The plugin name
	PluginName string `json:"plugin"`

	// Dynamic (i.e. defined by the plugin) string parameters
	StrParameters map[string]string `json:"str_parameters"`

	// Dynamic bool parameters
	BoolParameters map[string]bool `json:"bool_parameters"`

	// Holding place for data that is generated at runtime. E.g. can be used to store data parsed from the parameters
	Data map[string]interface{} `json:"-"` // No json here, runtime data only

	// The package version used to install this node (if installed yet)
	// This is useful to know in order to run migrations on upgrades.
	Version string `json:"version"`
	// contains filtered or unexported fields
}

Node represents a blockchain node, it's configuration and related information

func Load

func Load(nodeFile string) (Node, error)

Load all the data for a particular node and creates all required directories

func New

func New(nodeFile string) Node

New initializes a new instance of Node

func (Node) NamePrefix

func (c Node) NamePrefix() string

NamePrefix returns the prefix used as a convention when naming containers, volumes, networks, etc.

func (Node) NodeDirectory

func (c Node) NodeDirectory() string

NodeDirectory returns the base directory under which all configuration and meta-data for this node is stored

func (Node) NodeFile

func (c Node) NodeFile() string

NodeFile returns the filepath in which the base configuration as well as meta-data from the PBG is stored

func (Node) Remove

func (c Node) Remove() error

Remove removes a node by deleting the node directory

func (Node) Save

func (c Node) Save() error

Save the node data

Jump to

Keyboard shortcuts

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