Documentation ¶
Index ¶
- Constants
- func DynamicStartPreInit(nodeConfig *NodeConfig) error
- func GetSnapshot(ctx context.Context, client *client.Client) (*inmem.Snapshot, error)
- func GetSnapshotAtEpochAndPhase(ctx context.Context, log zerolog.Logger, startupEpoch uint64, ...) (protocol.Snapshot, error)
- func LoadNodeMachineAccountInfoFile(bootstrapDir string, nodeID flow.Identifier) (*bootstrap.NodeMachineAccountInfo, error)
- func LoadPrivateNodeInfo(dir string, myID flow.Identifier) (*bootstrap.NodeInfoPriv, error)
- func MarkFlagRequired(command *cobra.Command, flagName string)
- func ValidateDynamicStartupFlags(accessPublicKey, accessAddress string, startPhase flow.EpochPhase) error
- type BaseConfig
- type BuilderFunc
- type DependencyList
- type ExecutionConfig
- type ExecutionNode
- func (exeNode *ExecutionNode) LoadAuthorizationCheckingFunction(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadBlobService(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadBlobservicePeerManagerDependencies(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadBootstrapper(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadCheckerEngine(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadCollectionRequesterEngine(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadDeltasMempool(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadExecutionDataDatastore(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadExecutionDataGetter(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadExecutionDataPruner(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadExecutionMetrics(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadExecutionReceiptsStorage(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadExecutionState(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadExecutionStateLedger(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadExecutionStateLedgerWALCompactor(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadFinalizedSnapshot(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadFollowerEngine(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadGCPBlockDataUploader(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadGrpcServer(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadIngestionEngine(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadMutableFollowerState(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadPendingBlockCache(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadProviderEngine(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadReceiptProviderEngine(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadS3BlockDataUploader(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadStopControl(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadSyncCore(node *NodeConfig) error
- func (exeNode *ExecutionNode) LoadSynchronizationEngine(node *NodeConfig) (module.ReadyDoneAware, error)
- func (exeNode *ExecutionNode) LoadSystemSpecs(node *NodeConfig) error
- type ExecutionNodeBuilder
- type FlowNodeBuilder
- func (fnb *FlowNodeBuilder) AdminCommand(command string, f func(config *NodeConfig) commands.AdminCommand) NodeBuilder
- func (fnb *FlowNodeBuilder) BaseFlags()
- func (fnb *FlowNodeBuilder) Build() (Node, error)
- func (fnb *FlowNodeBuilder) Component(name string, f ReadyDoneFactory) NodeBuilder
- func (fnb *FlowNodeBuilder) DependableComponent(name string, f ReadyDoneFactory, dependencies *DependencyList) NodeBuilder
- func (fnb *FlowNodeBuilder) EnqueueAdminServerInit()
- func (fnb *FlowNodeBuilder) EnqueueMetricsServerInit()
- func (fnb *FlowNodeBuilder) EnqueueNetworkInit()
- func (fnb *FlowNodeBuilder) EnqueuePingService()
- func (fnb *FlowNodeBuilder) EnqueueProfiler()
- func (fnb *FlowNodeBuilder) EnqueueResolver()
- func (fnb *FlowNodeBuilder) EnqueueTracer()
- func (fnb *FlowNodeBuilder) ExtraFlags(f func(*pflag.FlagSet)) NodeBuilder
- func (fnb *FlowNodeBuilder) InitFlowNetworkWithConduitFactory(node *NodeConfig, cf network.ConduitFactory) (network.Network, error)
- func (fnb *FlowNodeBuilder) InitIDProviders()
- func (fnb *FlowNodeBuilder) Initialize() error
- func (fnb *FlowNodeBuilder) Module(name string, f BuilderFunc) NodeBuilder
- func (fnb *FlowNodeBuilder) MustNot(err error) *zerolog.Event
- func (fnb *FlowNodeBuilder) OverrideComponent(name string, f ReadyDoneFactory) NodeBuilder
- func (fnb *FlowNodeBuilder) OverrideModule(name string, f BuilderFunc) NodeBuilder
- func (fnb *FlowNodeBuilder) ParseAndPrintFlags() error
- func (fnb *FlowNodeBuilder) PostInit(f BuilderFunc) NodeBuilder
- func (fnb *FlowNodeBuilder) PreInit(f BuilderFunc) NodeBuilder
- func (fnb *FlowNodeBuilder) PrintBuildVersionDetails()
- func (fnb *FlowNodeBuilder) RegisterBadgerMetrics() error
- func (fnb *FlowNodeBuilder) RegisterDefaultAdminCommands()
- func (fnb *FlowNodeBuilder) RestartableComponent(name string, f ReadyDoneFactory, errorHandler component.OnError) NodeBuilder
- func (fnb *FlowNodeBuilder) ShutdownFunc(fn func() error) NodeBuilder
- func (fnb *FlowNodeBuilder) ValidateFlags(f func() error) NodeBuilder
- type FlowNodeImp
- type GetProtocolSnapshot
- type Metrics
- type NetworkConfig
- type Node
- type NodeBuilder
- type NodeConfig
- type Option
- func WithBindAddress(bindAddress string) Option
- func WithBootstrapDir(bootstrapDir string) Option
- func WithComplianceConfig(complianceConfig compliance.Config) Option
- func WithDB(db *badger.DB) Option
- func WithDataDir(dataDir string) Option
- func WithLogLevel(level string) Option
- func WithMetricsEnabled(enabled bool) Option
- func WithSecretsDBEnabled(enabled bool) Option
- func WithSyncCoreConfig(syncConfig chainsync.Config) Option
- type ReadyDoneFactory
- type Storage
- type VerificationConfig
- type VerificationNodeBuilder
Constants ¶
const ( NetworkComponent = "network" ConduitFactoryComponent = "conduit-factory" )
const NotSet = "not set"
Variables ¶
This section is empty.
Functions ¶
func DynamicStartPreInit ¶ added in v0.23.9
func DynamicStartPreInit(nodeConfig *NodeConfig) error
DynamicStartPreInit is the pre-init func that will check if a node has already bootstrapped from a root protocol snapshot. If not attempt to get a protocol snapshot where the following conditions are met. 1. Target epoch < current epoch (in the past), set root snapshot to current snapshot 2. Target epoch == "current", wait until target phase == current phase before setting root snapshot 3. Target epoch > current epoch (in future), wait until target epoch and target phase is reached before setting root snapshot
func GetSnapshot ¶ added in v0.23.9
GetSnapshot will attempt to get the latest finalized protocol snapshot with the given flow configs
func GetSnapshotAtEpochAndPhase ¶ added in v0.23.9
func GetSnapshotAtEpochAndPhase(ctx context.Context, log zerolog.Logger, startupEpoch uint64, startupEpochPhase flow.EpochPhase, retryInterval time.Duration, getSnapshot GetProtocolSnapshot) (protocol.Snapshot, error)
GetSnapshotAtEpochAndPhase will get the latest finalized protocol snapshot and check the current epoch and epoch phase. If we are past the target epoch and epoch phase we exit the retry mechanism immediately. If not check the snapshot at the specified interval until we reach the target epoch and phase.
func LoadNodeMachineAccountInfoFile ¶ added in v0.20.0
func LoadNodeMachineAccountInfoFile(bootstrapDir string, nodeID flow.Identifier) (*bootstrap.NodeMachineAccountInfo, error)
LoadNodeMachineAccountInfoFile loads machine account info from the default location within the bootstrap directory - Currently being used by Collection and Consensus nodes
func LoadPrivateNodeInfo ¶ added in v0.22.8
func LoadPrivateNodeInfo(dir string, myID flow.Identifier) (*bootstrap.NodeInfoPriv, error)
LoadPrivateNodeInfo the private info for this node from disk (e.g., private staking/network keys).
func MarkFlagRequired ¶ added in v0.22.0
MarkFlagRequired marks a flag added to a cobra command as required. Panics if the flag has not been added to the cobra command (indicates misconfiguration or typo).
func ValidateDynamicStartupFlags ¶ added in v0.23.9
func ValidateDynamicStartupFlags(accessPublicKey, accessAddress string, startPhase flow.EpochPhase) error
ValidateDynamicStartupFlags will validate flags necessary for dynamic node startup - assert dynamic-startup-access-publickey is valid ECDSA_P256 public key hex - assert dynamic-startup-access-address is not empty - assert dynamic-startup-startup-epoch-phase is > 0 (EpochPhaseUndefined)
Types ¶
type BaseConfig ¶
type BaseConfig struct { NetworkConfig AdminAddr string AdminCert string AdminKey string AdminClientCAs string BindAddr string NodeRole string DynamicStartupANAddress string DynamicStartupANPubkey string DynamicStartupEpochPhase string DynamicStartupEpoch string DynamicStartupSleepInterval time.Duration InsecureSecretsDB bool BootstrapDir string MetricsEnabled bool HeroCacheMetricsEnable bool SyncCoreConfig chainsync.Config CodecFactory func() network.Codec LibP2PNode *p2pnode.Node // ComplianceConfig configures either the compliance engine (consensus nodes) // or the follower engine (all other node roles) ComplianceConfig compliance.Config // contains filtered or unexported fields }
BaseConfig is the general config for the NodeBuilder and the command line params For a node running as a standalone process, the config fields will be populated from the command line params, while for a node running as a library, the config fields are expected to be initialized by the caller.
func DefaultBaseConfig ¶ added in v0.21.0
func DefaultBaseConfig() *BaseConfig
type BuilderFunc ¶ added in v0.23.9
type BuilderFunc func(nodeConfig *NodeConfig) error
type DependencyList ¶ added in v0.28.0
type DependencyList struct {
// contains filtered or unexported fields
}
DependencyList is a slice of ReadyDoneAware implementations that are used by DependableComponent to define the list of depenencies that must be ready before starting the component.
func (*DependencyList) Add ¶ added in v0.28.0
func (d *DependencyList) Add(component module.ReadyDoneAware)
Add adds a new ReadyDoneAware implementation to the list of dependencies.
type ExecutionConfig ¶ added in v0.26.0
type ExecutionConfig struct {
// contains filtered or unexported fields
}
ExecutionConfig contains the configs for starting up execution nodes
func (*ExecutionConfig) SetupFlags ¶ added in v0.28.0
func (exeConf *ExecutionConfig) SetupFlags(flags *pflag.FlagSet)
func (*ExecutionConfig) ValidateFlags ¶ added in v0.28.0
func (exeConf *ExecutionConfig) ValidateFlags() error
type ExecutionNode ¶ added in v0.28.0
type ExecutionNode struct {
// contains filtered or unexported fields
}
ExecutionNode contains the running modules and their loading code.
func (*ExecutionNode) LoadAuthorizationCheckingFunction ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadAuthorizationCheckingFunction( node *NodeConfig, ) error
func (*ExecutionNode) LoadBlobService ¶ added in v0.28.8
func (exeNode *ExecutionNode) LoadBlobService( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadBlobservicePeerManagerDependencies ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadBlobservicePeerManagerDependencies(node *NodeConfig) error
func (*ExecutionNode) LoadBootstrapper ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadBootstrapper(node *NodeConfig) error
func (*ExecutionNode) LoadCheckerEngine ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadCheckerEngine( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadCollectionRequesterEngine ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadCollectionRequesterEngine( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadDeltasMempool ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadDeltasMempool(node *NodeConfig) error
func (*ExecutionNode) LoadExecutionDataDatastore ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionDataDatastore( node *NodeConfig, ) error
func (*ExecutionNode) LoadExecutionDataGetter ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionDataGetter(node *NodeConfig) error
func (*ExecutionNode) LoadExecutionDataPruner ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionDataPruner( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadExecutionMetrics ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionMetrics(node *NodeConfig) error
func (*ExecutionNode) LoadExecutionReceiptsStorage ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionReceiptsStorage( node *NodeConfig, ) error
func (*ExecutionNode) LoadExecutionState ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionState( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadExecutionStateLedger ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionStateLedger( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadExecutionStateLedgerWALCompactor ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadExecutionStateLedgerWALCompactor( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadFinalizedSnapshot ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadFinalizedSnapshot( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadFollowerEngine ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadFollowerEngine( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadGCPBlockDataUploader ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadGCPBlockDataUploader( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadGrpcServer ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadGrpcServer( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadIngestionEngine ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadIngestionEngine( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadMutableFollowerState ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadMutableFollowerState(node *NodeConfig) error
func (*ExecutionNode) LoadPendingBlockCache ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadPendingBlockCache(node *NodeConfig) error
func (*ExecutionNode) LoadProviderEngine ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadProviderEngine( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadReceiptProviderEngine ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadReceiptProviderEngine( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadS3BlockDataUploader ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadS3BlockDataUploader( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadStopControl ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadStopControl( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadSyncCore ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadSyncCore(node *NodeConfig) error
func (*ExecutionNode) LoadSynchronizationEngine ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadSynchronizationEngine( node *NodeConfig, ) ( module.ReadyDoneAware, error, )
func (*ExecutionNode) LoadSystemSpecs ¶ added in v0.28.0
func (exeNode *ExecutionNode) LoadSystemSpecs(node *NodeConfig) error
type ExecutionNodeBuilder ¶ added in v0.26.0
type ExecutionNodeBuilder struct { *FlowNodeBuilder // the common configs as a node // contains filtered or unexported fields }
func NewExecutionNodeBuilder ¶ added in v0.26.0
func NewExecutionNodeBuilder(nodeBuilder *FlowNodeBuilder) *ExecutionNodeBuilder
func (*ExecutionNodeBuilder) LoadComponentsAndModules ¶ added in v0.26.0
func (builder *ExecutionNodeBuilder) LoadComponentsAndModules()
func (*ExecutionNodeBuilder) LoadFlags ¶ added in v0.26.0
func (builder *ExecutionNodeBuilder) LoadFlags()
type FlowNodeBuilder ¶
type FlowNodeBuilder struct { *NodeConfig // contains filtered or unexported fields }
FlowNodeBuilder is the default 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 The initialization can be proceeded and succeeded with PreInit and PostInit functions that allow customization of the process in case of nodes such as the unstaked access node where the NodeInfo is not part of the genesis data
func FlowNode ¶
func FlowNode(role string, opts ...Option) *FlowNodeBuilder
FlowNode creates a new Flow node builder with the given name.
func (*FlowNodeBuilder) AdminCommand ¶ added in v0.22.0
func (fnb *FlowNodeBuilder) AdminCommand(command string, f func(config *NodeConfig) commands.AdminCommand) NodeBuilder
func (*FlowNodeBuilder) BaseFlags ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) BaseFlags()
func (*FlowNodeBuilder) Build ¶ added in v0.23.9
func (fnb *FlowNodeBuilder) Build() (Node, error)
func (*FlowNodeBuilder) Component ¶
func (fnb *FlowNodeBuilder) Component(name string, f ReadyDoneFactory) NodeBuilder
Component adds a new component to the node that conforms to the ReadyDoneAware interface.
The ReadyDoneFactory may return either a `Component` or `ReadyDoneAware` instance. In both cases, the object is started when the node is run, and the node will wait for the component to exit gracefully.
func (*FlowNodeBuilder) DependableComponent ¶ added in v0.28.0
func (fnb *FlowNodeBuilder) DependableComponent(name string, f ReadyDoneFactory, dependencies *DependencyList) NodeBuilder
DependableComponent adds a new component to the node that conforms to the ReadyDoneAware interface. The builder will wait until all of the components in the dependencies list are ready before constructing the component.
The ReadyDoneFactory may return either a `Component` or `ReadyDoneAware` instance. In both cases, the object is started when the node is run, and the node will wait for the component to exit gracefully.
IMPORTANT: Dependable components are started in parallel with no guaranteed run order, so all dependencies must be initialized outside of the ReadyDoneFactory, and their `Ready()` method MUST be idempotent.
func (*FlowNodeBuilder) EnqueueAdminServerInit ¶ added in v0.22.0
func (fnb *FlowNodeBuilder) EnqueueAdminServerInit()
func (*FlowNodeBuilder) EnqueueMetricsServerInit ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) EnqueueMetricsServerInit()
func (*FlowNodeBuilder) EnqueueNetworkInit ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) EnqueueNetworkInit()
func (*FlowNodeBuilder) EnqueuePingService ¶ added in v0.23.9
func (fnb *FlowNodeBuilder) EnqueuePingService()
func (*FlowNodeBuilder) EnqueueProfiler ¶ added in v0.28.10
func (fnb *FlowNodeBuilder) EnqueueProfiler()
func (*FlowNodeBuilder) EnqueueResolver ¶ added in v0.23.9
func (fnb *FlowNodeBuilder) EnqueueResolver()
func (*FlowNodeBuilder) EnqueueTracer ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) EnqueueTracer()
func (*FlowNodeBuilder) ExtraFlags ¶
func (fnb *FlowNodeBuilder) ExtraFlags(f func(*pflag.FlagSet)) NodeBuilder
ExtraFlags enables binding additional flags beyond those defined in BaseConfig.
func (*FlowNodeBuilder) InitFlowNetworkWithConduitFactory ¶ added in v0.26.0
func (fnb *FlowNodeBuilder) InitFlowNetworkWithConduitFactory(node *NodeConfig, cf network.ConduitFactory) (network.Network, error)
func (*FlowNodeBuilder) InitIDProviders ¶ added in v0.21.1
func (fnb *FlowNodeBuilder) InitIDProviders()
func (*FlowNodeBuilder) Initialize ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) Initialize() error
func (*FlowNodeBuilder) Module ¶
func (fnb *FlowNodeBuilder) Module(name string, f BuilderFunc) NodeBuilder
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) OverrideComponent ¶ added in v0.26.0
func (fnb *FlowNodeBuilder) OverrideComponent(name string, f ReadyDoneFactory) NodeBuilder
OverrideComponent adds given builder function to the components set of the node builder. If a builder function with that name already exists, it will be overridden.
func (*FlowNodeBuilder) OverrideModule ¶ added in v0.28.0
func (fnb *FlowNodeBuilder) OverrideModule(name string, f BuilderFunc) NodeBuilder
OverrideModule adds given builder function to the modules set of the node builder. If a builder function with that name already exists, it will be overridden.
func (*FlowNodeBuilder) ParseAndPrintFlags ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) ParseAndPrintFlags() error
func (*FlowNodeBuilder) PostInit ¶
func (fnb *FlowNodeBuilder) PostInit(f BuilderFunc) NodeBuilder
func (*FlowNodeBuilder) PreInit ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) PreInit(f BuilderFunc) NodeBuilder
func (*FlowNodeBuilder) PrintBuildVersionDetails ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) PrintBuildVersionDetails()
func (*FlowNodeBuilder) RegisterBadgerMetrics ¶ added in v0.20.0
func (fnb *FlowNodeBuilder) RegisterBadgerMetrics() error
func (*FlowNodeBuilder) RegisterDefaultAdminCommands ¶ added in v0.23.0
func (fnb *FlowNodeBuilder) RegisterDefaultAdminCommands()
func (*FlowNodeBuilder) RestartableComponent ¶ added in v0.26.2
func (fnb *FlowNodeBuilder) RestartableComponent(name string, f ReadyDoneFactory, errorHandler component.OnError) NodeBuilder
RestartableComponent adds a new component to the node that conforms to the ReadyDoneAware interface, and calls the provided error handler when an irrecoverable error is encountered. Use RestartableComponent if the component is not critical to the node's safe operation and can/should be independently restarted when an irrecoverable error is encountered.
IMPORTANT: Since a RestartableComponent can be restarted independently of the node, the node and other components must not rely on it for safe operation, and failures must be handled gracefully. As such, RestartableComponents do not block the node from becoming ready, and do not block subsequent components from starting serially. They do start in serial order.
Note: The ReadyDoneFactory method may be called multiple times if the component is restarted.
Any irrecoverable errors thrown by the component will be passed to the provided error handler.
func (*FlowNodeBuilder) ShutdownFunc ¶ added in v0.23.9
func (fnb *FlowNodeBuilder) ShutdownFunc(fn func() error) NodeBuilder
ShutdownFunc adds a callback function that is called after all components have exited.
func (*FlowNodeBuilder) ValidateFlags ¶ added in v0.20.6
func (fnb *FlowNodeBuilder) ValidateFlags(f func() error) NodeBuilder
type FlowNodeImp ¶ added in v0.23.9
type FlowNodeImp struct { component.Component *NodeConfig // contains filtered or unexported fields }
FlowNodeImp is created by the FlowNodeBuilder with all components ready to be started. The Run function starts all the components, and is blocked until either a termination signal is received or a irrecoverable error is encountered.
func (*FlowNodeImp) Run ¶ added in v0.23.9
func (node *FlowNodeImp) Run()
Run starts all the node's components, then blocks until a SIGINT or SIGTERM is received, at which point it gracefully shuts down. Any unhandled irrecoverable errors thrown in child components will propagate up to here and result in a fatal error.
type GetProtocolSnapshot ¶ added in v0.23.9
GetProtocolSnapshot callback that will get latest finalized protocol snapshot
type Metrics ¶
type Metrics struct { Network module.NetworkMetrics Engine module.EngineMetrics Compliance module.ComplianceMetrics Cache module.CacheMetrics Mempool module.MempoolMetrics CleanCollector module.CleanerMetrics Bitswap module.BitswapMetrics }
type NetworkConfig ¶ added in v0.28.0
type NetworkConfig struct { // NetworkConnectionPruning determines whether connections to nodes // that are not part of protocol state should be trimmed // TODO: solely a fallback mechanism, can be removed upon reliable behavior in production. NetworkConnectionPruning bool PeerScoringEnabled bool // enables peer scoring on pubsub PreferredUnicastProtocols []string NetworkReceivedMessageCacheSize uint32 PeerUpdateInterval time.Duration UnicastMessageTimeout time.Duration DNSCacheTTL time.Duration }
type Node ¶ added in v0.23.9
type NodeBuilder ¶ added in v0.20.0
type NodeBuilder interface { // BaseFlags reads the command line arguments common to all nodes BaseFlags() // ExtraFlags reads the node specific command line arguments and adds it to the FlagSet ExtraFlags(f func(*pflag.FlagSet)) NodeBuilder // ParseAndPrintFlags parses and validates all the command line arguments ParseAndPrintFlags() error // Initialize performs all the initialization needed at the very start of a node Initialize() error // PrintBuildVersionDetails prints the node software build version PrintBuildVersionDetails() // InitIDProviders initializes the ID providers needed by various components InitIDProviders() // EnqueueNetworkInit enqueues the default networking layer. EnqueueNetworkInit() // EnqueueMetricsServerInit enqueues the metrics component. EnqueueMetricsServerInit() // EnqueueTracer enqueues the Tracer component. EnqueueTracer() // Module enables setting up dependencies of the engine with the builder context Module(name string, f BuilderFunc) NodeBuilder // Component adds a new component to the node that conforms to the ReadyDoneAware // interface, and throws a Fatal() when an irrecoverable error is encountered. // // The ReadyDoneFactory may return either a `Component` or `ReadyDoneAware` instance. // In both cases, the object is started according to its interface when the node is run, // and the node will wait for the component to exit gracefully. Component(name string, f ReadyDoneFactory) NodeBuilder // DependableComponent adds a new component to the node that conforms to the ReadyDoneAware // interface. The builder will wait until all of the components in the dependencies list are ready // before constructing the component. // // The ReadyDoneFactory may return either a `Component` or `ReadyDoneAware` instance. // In both cases, the object is started when the node is run, and the node will wait for the // component to exit gracefully. // // IMPORTANT: Dependable components are started in parallel with no guaranteed run order, so all // dependencies must be initialized outside of the ReadyDoneFactory, and their `Ready()` method // MUST be idempotent. DependableComponent(name string, f ReadyDoneFactory, dependencies *DependencyList) NodeBuilder // RestartableComponent adds a new component to the node that conforms to the ReadyDoneAware // interface, and calls the provided error handler when an irrecoverable error is encountered. // Use RestartableComponent if the component is not critical to the node's safe operation and // can/should be independently restarted when an irrecoverable error is encountered. // // Any irrecoverable errors thrown by the component will be passed to the provided error handler. RestartableComponent(name string, f ReadyDoneFactory, errorHandler component.OnError) NodeBuilder // ShutdownFunc adds a callback function that is called after all components have exited. // All shutdown functions are called regardless of errors returned by previous callbacks. Any // errors returned are captured and passed to the caller. ShutdownFunc(fn func() error) NodeBuilder // AdminCommand registers a new admin command with the admin server AdminCommand(command string, f func(config *NodeConfig) commands.AdminCommand) NodeBuilder // 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. MustNot(err error) *zerolog.Event // Build finalizes the node configuration in preparation for start and returns a Node // object that can be run Build() (Node, error) // PreInit registers a new PreInit function. // PreInit functions run before the protocol state is initialized or any other modules or components are initialized PreInit(f BuilderFunc) NodeBuilder // PostInit registers a new PreInit function. // PostInit functions run after the protocol state has been initialized but before any other modules or components // are initialized PostInit(f BuilderFunc) NodeBuilder // RegisterBadgerMetrics registers all badger related metrics RegisterBadgerMetrics() error // ValidateFlags sets any custom validation rules for the command line flags, // for example where certain combinations aren't allowed ValidateFlags(func() error) NodeBuilder }
NodeBuilder declares the initialization methods needed to bootstrap up a Flow node
type NodeConfig ¶ added in v0.20.0
type NodeConfig struct { Cancel context.CancelFunc // cancel function for the context that is passed to the networking layer BaseConfig Logger zerolog.Logger NodeID flow.Identifier Me module.Local Tracer module.Tracer ConfigManager *updatable_configs.Manager MetricsRegisterer prometheus.Registerer Metrics Metrics DB *badger.DB SecretsDB *badger.DB Storage Storage ProtocolEvents *events.Distributor State protocol.State Resolver madns.BasicResolver Middleware network.Middleware Network network.Network PingService network.PingService MsgValidators []network.MessageValidator FvmOptions []fvm.Option StakingKey crypto.PrivateKey NetworkKey crypto.PrivateKey // list of dependencies for network peer manager startup PeerManagerDependencies *DependencyList // ID providers IdentityProvider module.IdentityProvider IDTranslator p2p.IDTranslator SyncEngineIdentifierProvider module.IdentifierProvider // root state information RootSnapshot protocol.Snapshot // cached properties of RootSnapshot for convenience RootBlock *flow.Block RootQC *flow.QuorumCertificate RootResult *flow.ExecutionResult RootSeal *flow.Seal RootChainID flow.ChainID SporkID flow.Identifier // bootstrapping options SkipNwAddressBasedValidations bool // contains filtered or unexported fields }
NodeConfig contains all the derived parameters such the NodeID, private keys etc. and initialized instances of structs such as DB, Network etc. The NodeConfig is composed of the BaseConfig and is updated in the NodeBuilder functions as a node is bootstrapped.
type Option ¶ added in v0.21.0
type Option func(*BaseConfig)
func WithBindAddress ¶ added in v0.21.1
func WithBootstrapDir ¶ added in v0.21.0
func WithComplianceConfig ¶ added in v0.26.16
func WithComplianceConfig(complianceConfig compliance.Config) Option
func WithDB ¶ added in v0.21.1
func WithDB(db *badger.DB) Option
WithDB takes precedence over WithDataDir and datadir will be set to empty if DB is set using this option
func WithDataDir ¶ added in v0.21.0
func WithLogLevel ¶ added in v0.21.1
func WithMetricsEnabled ¶ added in v0.21.0
func WithSecretsDBEnabled ¶ added in v0.22.4
func WithSyncCoreConfig ¶ added in v0.26.0
type ReadyDoneFactory ¶ added in v0.23.9
type ReadyDoneFactory func(node *NodeConfig) (module.ReadyDoneAware, error)
type VerificationConfig ¶ added in v0.26.0
type VerificationConfig struct {
// contains filtered or unexported fields
}
type VerificationNodeBuilder ¶ added in v0.26.0
type VerificationNodeBuilder struct { *FlowNodeBuilder // contains filtered or unexported fields }
func NewVerificationNodeBuilder ¶ added in v0.26.0
func NewVerificationNodeBuilder(nodeBuilder *FlowNodeBuilder) *VerificationNodeBuilder
func (*VerificationNodeBuilder) LoadComponentsAndModules ¶ added in v0.26.0
func (v *VerificationNodeBuilder) LoadComponentsAndModules()
func (*VerificationNodeBuilder) LoadFlags ¶ added in v0.26.0
func (v *VerificationNodeBuilder) LoadFlags()
Source Files ¶
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. |
Package build contains information about the build that injected at build-time.
|
Package build contains information about the build that injected at build-time. |
testclient
module
|
|