Documentation ¶
Index ¶
- func BootstrapIdentities(addresses []string, keys []string) (flow.IdentityList, error)
- type BootstrapNodeInfo
- type Config
- type ConsensusFollower
- type ConsensusFollowerImpl
- type FollowerOption
- type FollowerServiceBuilder
- type FollowerServiceConfig
- type Option
- func WithBootstrapDir(bootstrapDir string) Option
- func WithComplianceConfig(config *compliance.Config) Option
- func WithDB(db *badger.DB) Option
- func WithDataDir(dataDir string) Option
- func WithExposeMetrics(expose bool) Option
- func WithLogLevel(level string) Option
- func WithSyncCoreConfig(config *chainsync.Config) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootstrapIdentities ¶
func BootstrapIdentities(addresses []string, keys []string) (flow.IdentityList, error)
BootstrapIdentities converts the bootstrap node addresses and keys to a Flow Identity list where each Flow Identity is initialized with the passed address, the networking key and the Node ID set to ZeroID, role set to Access, 0 stake and no staking key.
Types ¶
type BootstrapNodeInfo ¶
type BootstrapNodeInfo struct { Host string // ip or hostname Port uint NetworkPublicKey crypto.PublicKey // the network public key of the bootstrap peer }
BootstrapNodeInfo contains the details about the upstream bootstrap peer the consensus follower uses
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config contains the configurable fields for a `ConsensusFollower`.
type ConsensusFollower ¶
type ConsensusFollower interface { component.Component // Run starts the consensus follower. Run(context.Context) // AddOnBlockFinalizedConsumer adds a new block finalization subscriber. AddOnBlockFinalizedConsumer(pubsub.OnBlockFinalizedConsumer) }
ConsensusFollower is a standalone module run by third parties which provides a mechanism for observing the block chain. It maintains a set of subscribers and delivers block proposals broadcasted by the consensus nodes to each one.
type ConsensusFollowerImpl ¶
type ConsensusFollowerImpl struct { component.Component *cmd.NodeConfig // contains filtered or unexported fields }
func NewConsensusFollower ¶
func NewConsensusFollower( networkPrivKey crypto.PrivateKey, bindAddr string, bootstapIdentities []BootstrapNodeInfo, opts ...Option, ) (*ConsensusFollowerImpl, error)
NewConsensusFollower creates a new consensus follower.
func (*ConsensusFollowerImpl) AddOnBlockFinalizedConsumer ¶
func (cf *ConsensusFollowerImpl) AddOnBlockFinalizedConsumer(consumer pubsub.OnBlockFinalizedConsumer)
AddOnBlockFinalizedConsumer adds a new block finalization subscriber.
func (*ConsensusFollowerImpl) Run ¶
func (cf *ConsensusFollowerImpl) Run(ctx context.Context)
Run starts the consensus follower. This may also be implemented directly in a calling library to take advantage of error recovery possible with the irrecoverable error handling.
type FollowerOption ¶
type FollowerOption func(*FollowerServiceConfig)
func WithBaseOptions ¶
func WithBaseOptions(baseOptions []cmd.Option) FollowerOption
func WithBootStrapPeers ¶
func WithBootStrapPeers(bootstrapNodes ...*flow.Identity) FollowerOption
func WithNetworkKey ¶
func WithNetworkKey(key crypto.PrivateKey) FollowerOption
type FollowerServiceBuilder ¶
type FollowerServiceBuilder struct { *cmd.FlowNodeBuilder *FollowerServiceConfig // components LibP2PNode p2p.LibP2PNode FollowerState protocol.MutableState SyncCore *synchronization.Core FinalizationDistributor *pubsub.FinalizationDistributor FinalizedHeader *synceng.FinalizedHeaderCache Committee hotstuff.Committee Finalized *flow.Header Pending []*flow.Header FollowerCore module.HotStuffFollower // for the observer, the sync engine participants provider is the libp2p peer store which is not // available until after the network has started. Hence, a factory function that needs to be called just before // creating the sync engine SyncEngineParticipantsProviderFactory func() module.IdentifierProvider // engines FollowerEng *followereng.Engine SyncEng *synceng.Engine // contains filtered or unexported fields }
FollowerServiceBuilder provides the common functionality needed to bootstrap a Flow staked and observer It is composed of the FlowNodeBuilder, the FollowerServiceConfig and contains all the components and modules needed for the staked and observers
func FlowConsensusFollowerService ¶
func FlowConsensusFollowerService(opts ...FollowerOption) *FollowerServiceBuilder
func (*FollowerServiceBuilder) Build ¶
func (builder *FollowerServiceBuilder) Build() (cmd.Node, error)
Build enqueues the sync engine and the follower engine for the observer. Currently, the observer only runs the follower engine.
func (*FollowerServiceBuilder) BuildConsensusFollower ¶
func (builder *FollowerServiceBuilder) BuildConsensusFollower() cmd.NodeBuilder
func (*FollowerServiceBuilder) InitIDProviders ¶
func (builder *FollowerServiceBuilder) InitIDProviders()
func (*FollowerServiceBuilder) Initialize ¶
func (builder *FollowerServiceBuilder) Initialize() error
type FollowerServiceConfig ¶
type FollowerServiceConfig struct { NetworkKey crypto.PrivateKey // the networking key passed in by the caller when being used as a library // contains filtered or unexported fields }
FollowerServiceConfig defines all the user defined parameters required to bootstrap an access node 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 DefaultFollowerServiceConfig ¶
func DefaultFollowerServiceConfig() *FollowerServiceConfig
DefaultFollowerServiceConfig defines all the default values for the FollowerServiceConfig
type Option ¶
type Option func(c *Config)
func WithBootstrapDir ¶
func WithComplianceConfig ¶
func WithComplianceConfig(config *compliance.Config) Option
func WithDB ¶
func WithDB(db *badger.DB) Option
WithDB sets the underlying database that will be used to store the chain state WithDB takes precedence over WithDataDir and datadir will be set to empty if DB is set using this option
func WithDataDir ¶
WithDataDir sets the underlying directory to be used to store the database If a database is supplied, then data directory will be set to empty string