dot

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: LGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKeystoreType = errors.New("invalid keystore type")

ErrInvalidKeystoreType when trying to create a service with the wrong keystore type

View Source
var ErrNoKeysProvided = errors.New("no keys provided for authority node")

ErrNoKeysProvided is returned when no keys are given for an authority node

Functions

func CreateJSONRawFile added in v0.2.0

func CreateJSONRawFile(bs *BuildSpec, fp string) *os.File

CreateJSONRawFile will generate an Json File

func ExportConfig

func ExportConfig(cfg *Config, fp string) *os.File

ExportConfig exports a dot configuration to a toml configuration file

func ExportTomlConfig added in v0.2.0

func ExportTomlConfig(cfg *ctoml.Config, fp string) *os.File

ExportTomlConfig exports a dot configuration to a toml configuration file

func InitNode

func InitNode(cfg *Config) error

InitNode initializes a new dot node from the provided dot node configuration and JSON formatted genesis file.

func NewTestGenesis

func NewTestGenesis(t *testing.T) *genesis.Genesis

NewTestGenesis returns a test genesis instance using "gssmr" raw data

func NewTestGenesisAndRuntime

func NewTestGenesisAndRuntime(t *testing.T) string

NewTestGenesisAndRuntime create a new test runtime and a new test genesis file with the test runtime stored in raw data and returns the genesis file nolint

func NewTestGenesisFile

func NewTestGenesisFile(t *testing.T, cfg *Config) *os.File

NewTestGenesisFile returns a human-readable test genesis file using "gssmr" human readable data

func NewTestGenesisRawFile added in v0.2.0

func NewTestGenesisRawFile(t *testing.T, cfg *Config) *os.File

NewTestGenesisRawFile returns a test genesis-raw file using "gssmr" raw data

func NodeInitialized

func NodeInitialized(basepath string, expected bool) bool

NodeInitialized returns true if, within the configured data directory for the node, the state database has been created and the genesis data has been loaded

func WriteConfig added in v0.2.0

func WriteConfig(data []byte, fp string) *os.File

WriteConfig writes the config `data` in the file 'fp'.

Types

type AccountConfig

type AccountConfig struct {
	Key    string // TODO: change to array
	Unlock string // TODO: change to array
}

AccountConfig is to marshal/unmarshal account config vars

type BuildSpec added in v0.2.0

type BuildSpec struct {
	// contains filtered or unexported fields
}

BuildSpec object for working with building genesis JSON files

func BuildFromDB added in v0.2.0

func BuildFromDB(path string) (*BuildSpec, error)

BuildFromDB builds a BuildSpec from the DB located at path

func BuildFromGenesis added in v0.2.0

func BuildFromGenesis(path string, authCount int) (*BuildSpec, error)

BuildFromGenesis builds a BuildSpec based on the human-readable genesis file at path

func (*BuildSpec) ToJSON added in v0.2.0

func (b *BuildSpec) ToJSON() ([]byte, error)

ToJSON outputs genesis JSON in human-readable form

func (*BuildSpec) ToJSONRaw added in v0.2.0

func (b *BuildSpec) ToJSONRaw() ([]byte, error)

ToJSONRaw outputs genesis JSON in raw form

type Config

type Config struct {
	Global  GlobalConfig
	Log     LogConfig
	Init    InitConfig
	Account AccountConfig
	Core    CoreConfig
	Network NetworkConfig
	RPC     RPCConfig
	System  types.SystemInfo
}

Config is a collection of configurations throughout the system

func GssmrConfig

func GssmrConfig() *Config

GssmrConfig returns a new test configuration using the provided basepath

func KsmccConfig

func KsmccConfig() *Config

KsmccConfig returns a "ksmcc" node configuration

func NewTestConfig

func NewTestConfig(t *testing.T) *Config

NewTestConfig returns a new test configuration using the provided basepath

func NewTestConfigWithFile

func NewTestConfigWithFile(t *testing.T) (*Config, *os.File)

NewTestConfigWithFile returns a new test configuration and a temporary configuration file

func PolkadotConfig added in v0.3.0

func PolkadotConfig() *Config

PolkadotConfig returns a "polkadot" node configuration

func (*Config) String

func (c *Config) String() string

String will return the json representation for a Config

type CoreConfig

type CoreConfig struct {
	Roles                    byte
	BabeAuthority            bool
	GrandpaAuthority         bool
	BabeThresholdNumerator   uint64
	BabeThresholdDenominator uint64
	SlotDuration             uint64
	EpochLength              uint64
	WasmInterpreter          string
}

CoreConfig is to marshal/unmarshal toml core config vars

type GlobalConfig

type GlobalConfig struct {
	Name     string
	ID       string
	BasePath string
	LogLvl   log.Lvl
}

GlobalConfig is used for every node command

type InitConfig

type InitConfig struct {
	GenesisRaw string
}

InitConfig is the configuration for the node initialization

type LogConfig added in v0.2.0

type LogConfig struct {
	CoreLvl           log.Lvl
	SyncLvl           log.Lvl
	NetworkLvl        log.Lvl
	RPCLvl            log.Lvl
	StateLvl          log.Lvl
	RuntimeLvl        log.Lvl
	BlockProducerLvl  log.Lvl
	FinalityGadgetLvl log.Lvl
}

LogConfig represents the log levels for individual packages

type NetworkConfig

type NetworkConfig struct {
	Port        uint32
	Bootnodes   []string
	ProtocolID  string
	NoBootstrap bool
	NoMDNS      bool
	MinPeers    int
	MaxPeers    int
}

NetworkConfig is to marshal/unmarshal toml network config vars

type Node

type Node struct {
	Name     string
	Services *services.ServiceRegistry // registry of all node services
	StopFunc func()                    // func to call when node stops, currently used for profiling
	// contains filtered or unexported fields
}

Node is a container for all the components of a node.

func NewNode

func NewNode(cfg *Config, ks *keystore.GlobalKeystore, stopFunc func()) (*Node, error)

NewNode creates a new dot node from a dot node configuration

func (*Node) Start

func (n *Node) Start() error

Start starts all dot node services

func (*Node) Stop

func (n *Node) Stop()

Stop stops all dot node services

type RPCConfig

type RPCConfig struct {
	Enabled    bool
	External   bool
	Port       uint32
	Host       string
	Modules    []string
	WSPort     uint32
	WS         bool
	WSExternal bool
}

RPCConfig is to marshal/unmarshal toml RPC config vars

Directories

Path Synopsis
config
rpc

Jump to

Keyboard shortcuts

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