node

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

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 Collection

type Collection struct {
	CA   string `json:"ca"`
	Cert string `json:"cert"`
	Host string `json:"host"`
	Key  string `json:"key"`
}

Collection is config for log and node data collection

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"`

	// Describes the collection configuration
	Collection Collection `json:"collection"`

	// Secrets (Example: Private keys)
	Secrets map[string]interface{} `json:"-"` // No json here, never serialize secrets!

	// 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

func (Node) ConfigsDirectory

func (c Node) ConfigsDirectory() string

ConfigsDirectorys returns the directory under which all configuration for the blockchain client is stored

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, secrets 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) Save

func (c Node) Save() error

Save the node data

func (Node) SecretsDirectory

func (c Node) SecretsDirectory() string

ConfigsDirectorys returns the directory under which all secrets for the blockchain client is stored

Jump to

Keyboard shortcuts

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