node

package
v0.2.24-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 55 Imported by: 0

Documentation

Overview

Package node contains the main executable for go-spacemesh node

Index

Constants

View Source
const (
	AppLogger              = "app"
	ClockLogger            = "clock"
	P2PLogger              = "p2p"
	PostLogger             = "post"
	StateDbLogger          = "stateDbStore"
	BeaconLogger           = "beacon"
	CachedDBLogger         = "cachedDB"
	PoetDbLogger           = "poetDb"
	TrtlLogger             = "trtl"
	ATXHandlerLogger       = "atxHandler"
	MeshLogger             = "mesh"
	SyncLogger             = "sync"
	HareOracleLogger       = "hareOracle"
	HareLogger             = "hare"
	BlockCertLogger        = "blockCert"
	BlockGenLogger         = "blockGenerator"
	BlockHandlerLogger     = "blockHandler"
	TxHandlerLogger        = "txHandler"
	ProposalBuilderLogger  = "proposalBuilder"
	ProposalListenerLogger = "proposalListener"
	NipostBuilderLogger    = "nipostBuilder"
	Fetcher                = "fetcher"
	TimeSyncLogger         = "timesync"
	VMLogger               = "vm"
	GRPCLogger             = "grpc"
	ConStateLogger         = "conState"
	Executor               = "executor"
	Malfeasance            = "malfeasance"
)

Logger names.

Variables

This section is empty.

Functions

func GetCommand

func GetCommand() *cobra.Command

func LoadConfigFromFile

func LoadConfigFromFile() (*config.Config, error)

LoadConfigFromFile tries to load configuration file if the config parameter was specified.

Types

type App

type App struct {
	*cobra.Command

	Config *config.Config
	// contains filtered or unexported fields
}

App is the cli app singleton.

func New

func New(opts ...Option) *App

New creates an instance of the spacemesh app.

func (*App) Cleanup

func (app *App) Cleanup(ctx context.Context)

Cleanup stops all app services.

func (*App) Initialize

func (app *App) Initialize() (err error)

Initialize sets up an exit signal, logging and checks the clock, returns error if clock is not in sync.

func (*App) LoadOrCreateEdSigner

func (app *App) LoadOrCreateEdSigner() (*signing.EdSigner, error)

LoadOrCreateEdSigner either loads a previously created ed identity for the node or creates a new one if not exists.

func (*App) SetLogLevel

func (app *App) SetLogLevel(name, loglevel string) error

SetLogLevel updates the log level of an existing logger.

func (*App) Start

func (app *App) Start(ctx context.Context) error

Start starts the Spacemesh node and initializes all relevant services according to command line arguments provided.

func (*App) Started

func (app *App) Started() chan struct{}

type NodeClock

type NodeClock interface {
	LayerToTime(types.LayerID) time.Time
	TimeToLayer(time.Time) types.LayerID
	GenesisTime() time.Time

	CurrentLayer() types.LayerID
	AwaitLayer(types.LayerID) chan struct{}

	Close()
}

NodeClock is an interface to a global system clock that releases ticks on each layer.

type Option

type Option func(app *App)

Option to modify an App instance.

func WithConfig

func WithConfig(conf *config.Config) Option

WithConfig overwrites default App config.

func WithLog

func WithLog(logger log.Log) Option

WithLog enables logger for an App.

type Service

type Service interface {
	Start(ctx context.Context) error
	Close()
}

Service is a general service interface that specifies the basic start/stop functionality.

Jump to

Keyboard shortcuts

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