cmd

package
v0.10.1-consensus-prin... Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: AGPL-3.0 Imports: 36 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	BootstrapDir string
	// contains filtered or unexported fields
}

BaseConfig is the general config for the FlowNodeBuilder

type FlowNodeBuilder

type FlowNodeBuilder struct {
	BaseConfig BaseConfig
	NodeID     flow.Identifier

	Logger            zerolog.Logger
	Me                *local.Local
	Tracer            *trace.OpenTracer
	MetricsRegisterer prometheus.Registerer
	Metrics           Metrics
	DB                *badger.DB
	Storage           Storage
	ProtocolEvents    *events.Distributor
	State             *protocol.State
	Middleware        *libp2p.Middleware
	Network           *libp2p.Network
	MsgValidators     []validators.MessageValidator
	FvmOptions        []fvm.Option

	// root state information
	RootBlock   *flow.Block
	RootQC      *flow.QuorumCertificate
	RootResult  *flow.ExecutionResult
	RootSeal    *flow.Seal
	RootChainID flow.ChainID
	// contains filtered or unexported fields
}

FlowNodeBuilder is the builder struct used for all flow nodes It runs a node process with following structure, in sequential order Base inits (network, storage, state, logger)

PostInit handlers, if any

Components handlers, if any, wait sequentially Run() <- main loop Components destructors, if any

func FlowNode

func FlowNode(role string) *FlowNodeBuilder

FlowNode creates a new Flow node builder with the given name.

func (*FlowNodeBuilder) Component

Component adds a new component to the node that conforms to the ReadyDone interface.

When the node is run, this component will be started with `Ready`. When the node is stopped, we will wait for the component to exit gracefully with `Done`.

func (*FlowNodeBuilder) ExtraFlags

func (fnb *FlowNodeBuilder) ExtraFlags(f func(*pflag.FlagSet)) *FlowNodeBuilder

ExtraFlags enables binding additional flags beyond those defined in BaseConfig.

func (*FlowNodeBuilder) Module

func (fnb *FlowNodeBuilder) Module(name string, f func(builder *FlowNodeBuilder) error) *FlowNodeBuilder

Module enables setting up dependencies of the engine with the builder context.

func (*FlowNodeBuilder) MustNot

func (fnb *FlowNodeBuilder) MustNot(err error) *zerolog.Event

MustNot asserts that the given error must not occur.

If the error is nil, returns a nil log event (which acts as a no-op). If the error is not nil, returns a fatal log event containing the error.

func (*FlowNodeBuilder) PostInit

func (fnb *FlowNodeBuilder) PostInit(f func(node *FlowNodeBuilder)) *FlowNodeBuilder

func (*FlowNodeBuilder) Run

func (fnb *FlowNodeBuilder) Run()

Run initiates all common components (logger, database, protocol state etc.) then starts each component. It also sets up a channel to gracefully shut down each component if a SIGINT is received.

type Metrics

type Metrics struct {
	Network    module.NetworkMetrics
	Engine     module.EngineMetrics
	Compliance module.ComplianceMetrics
	Cache      module.CacheMetrics
	Mempool    module.MempoolMetrics
}

type Storage

type Storage struct {
	Headers      storage.Headers
	Index        storage.Index
	Identities   storage.Identities
	Guarantees   storage.Guarantees
	Seals        storage.Seals
	Payloads     storage.Payloads
	Blocks       storage.Blocks
	Transactions storage.Transactions
	Collections  storage.Collections
	Setups       storage.EpochSetups
	Commits      storage.EpochCommits
	Statuses     storage.EpochStatuses
}

Directories

Path Synopsis
cmd
contains CLI logic that can exit the program and read/write files.
contains CLI logic that can exit the program and read/write files.
run
contains reusable logic that does not know about a CLI.
contains reusable logic that does not know about a CLI.
testclient module
cmd

Jump to

Keyboard shortcuts

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