Documentation
¶
Overview ¶
Copyright 2020 ChainSafe Systems (ON) Corp. This file is part of gossamer.
The gossamer library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The gossamer library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the gossamer library. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func CreateJSONRawFile(bs *BuildSpec, fp string) *os.File
- func ExportConfig(cfg *Config, fp string) *os.File
- func ExportTomlConfig(cfg *ctoml.Config, fp string) *os.File
- func InitNode(cfg *Config) error
- func NewTestGenesis(t *testing.T) *genesis.Genesis
- func NewTestGenesisAndRuntime(t *testing.T) string
- func NewTestGenesisFile(t *testing.T, cfg *Config) *os.File
- func NewTestGenesisRawFile(t *testing.T, cfg *Config) *os.File
- func NodeInitialized(basepath string, expected bool) bool
- func RPCServiceEnabled(cfg *Config) bool
- func WriteConfig(data []byte, fp string) *os.File
- type AccountConfig
- type BlockProducer
- type BuildSpec
- type Config
- type CoreConfig
- type GlobalConfig
- type InitConfig
- type LogConfig
- type NetworkConfig
- type Node
- type RPCConfig
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKeystoreType = errors.New("invalid keystore type")
ErrInvalidKeystoreType when trying to create a service with the wrong keystore type
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
CreateJSONRawFile will generate an Json File
func ExportConfig ¶
ExportConfig exports a dot configuration to a toml configuration file
func ExportTomlConfig ¶ added in v0.2.0
ExportTomlConfig exports a dot configuration to a toml configuration file
func InitNode ¶
InitNode initializes a new dot node from the provided dot node configuration and JSON formatted genesis file.
func NewTestGenesis ¶
NewTestGenesis returns a test genesis instance using "gssmr" raw data
func NewTestGenesisAndRuntime ¶
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 ¶
NewTestGenesisFile returns a human-readable test genesis file using "gssmr" human readable data
func NewTestGenesisRawFile ¶ added in v0.2.0
NewTestGenesisRawFile returns a test genesis-raw file using "gssmr" raw data
func NodeInitialized ¶
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 RPCServiceEnabled ¶
RPCServiceEnabled returns true if the rpc service is enabled
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 BlockProducer ¶ added in v0.2.0
type BlockProducer interface {
services.Service
GetBlockChannel() <-chan types.Block
SetRuntime(runtime.LegacyInstance) error
Pause() error
Resume() error
Authorities() []*types.Authority
SetAuthorities([]*types.Authority) error
SetRandomness([types.RandomnessLength]byte)
SetThreshold(*big.Int)
}
BlockProducer is the interface that a block production service must implement
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
BuildFromDB builds a BuildSpec from the DB located at path
func BuildFromGenesis ¶ added in v0.2.0
BuildFromGenesis builds a BuildSpec based on the human-readable genesis file at path
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 NewTestConfig ¶
NewTestConfig returns a new test configuration using the provided basepath
func NewTestConfigWithFile ¶
NewTestConfigWithFile returns a new test configuration and a temporary configuration file
type CoreConfig ¶
type CoreConfig struct {
Roles byte
BabeAuthority bool
GrandpaAuthority bool
BabeThreshold *big.Int
SlotDuration uint64
WasmInterpreter string
}
CoreConfig is to marshal/unmarshal toml core config vars
type GlobalConfig ¶
GlobalConfig is used for every node command
type InitConfig ¶
type InitConfig struct {
GenesisRaw string
// TestFirstEpoch determines whether to use test data for the first epoch
// If set to false, node initialization will load the babe configuration from the runtime to use as first epoch data
TestFirstEpoch bool
}
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
}
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.