Documentation ¶
Index ¶
- func TagForCommittee(kind scheduler.CommitteeKind) string
- type AccessPolicy
- func (ap AccessPolicy) AddPublicKeyPolicy(policy *accessctl.Policy, pubKey signature.PublicKey)
- func (ap AccessPolicy) AddRulesForCommittee(policy *accessctl.Policy, committee *CommitteeInfo, ...)
- func (ap AccessPolicy) AddRulesForNodeRoles(policy *accessctl.Policy, nodes []*node.Node, roles node.RolesMask)
- type CommitteeInfo
- type EpochSnapshot
- func (e *EpochSnapshot) GetEpochNumber() beacon.EpochTime
- func (e *EpochSnapshot) GetExecutorCommittee() *CommitteeInfo
- func (e *EpochSnapshot) GetGroupVersion() int64
- func (e *EpochSnapshot) GetRuntime() *registry.Runtime
- func (e *EpochSnapshot) GetStorageCommittee() *CommitteeInfo
- func (e *EpochSnapshot) IsExecutorBackupWorker() bool
- func (e *EpochSnapshot) IsExecutorMember() bool
- func (e *EpochSnapshot) IsExecutorWorker() bool
- func (e *EpochSnapshot) IsTransactionScheduler(round uint64) bool
- func (e *EpochSnapshot) Node(ctx context.Context, id signature.PublicKey) (*node.Node, error)
- func (e *EpochSnapshot) Nodes() nodes.NodeDescriptorLookup
- func (e *EpochSnapshot) VerifyCommitteeSignatures(kind scheduler.CommitteeKind, sigs []signature.Signature) error
- func (e *EpochSnapshot) VerifyTxnSchedulerSigner(sig signature.Signature, round uint64) error
- type Group
- func (g *Group) AuthenticatePeer(peerID signature.PublicKey, msg *p2p.Message) error
- func (g *Group) EpochTransition(ctx context.Context, height int64) error
- func (g *Group) GetEpochSnapshot() *EpochSnapshot
- func (g *Group) HandlePeerMessage(unusedPeerID signature.PublicKey, msg *p2p.Message, isOwn bool) error
- func (g *Group) Nodes() nodes.NodeDescriptorLookup
- func (g *Group) Peers() []string
- func (g *Group) Publish(spanCtx opentracing.SpanContext, msg *p2p.Message) error
- func (g *Group) RoundTransition()
- func (g *Group) Start() error
- func (g *Group) Storage() storage.Backend
- func (g *Group) StorageLocal() storage.LocalBackend
- func (g *Group) Suspend(ctx context.Context)
- type MessageHandler
- type Node
- func (n *Node) AddHooks(hooks NodeHooks)
- func (n *Node) Cleanup()
- func (n *Node) GetRuntime() runtimeRegistry.Runtime
- func (n *Node) GetStatus(ctx context.Context) (*api.Status, error)
- func (n *Node) HandlePeerMessage(ctx context.Context, message *p2p.Message, isOwn bool) error
- func (n *Node) Initialized() <-chan struct{}
- func (n *Node) Name() string
- func (n *Node) NewNotifier(ctx context.Context, host host.Runtime) protocol.Notifier
- func (n *Node) NewRuntimeHostHandler() protocol.Handler
- func (n *Node) Quit() <-chan struct{}
- func (n *Node) Start() error
- func (n *Node) Stop()
- type NodeHooks
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TagForCommittee ¶ added in v0.2012.0
func TagForCommittee(kind scheduler.CommitteeKind) string
TagForCommittee returns node lookup tag for scheduler committee kind.
Types ¶
type AccessPolicy ¶
AccessPolicy defines a list of actions that are allowed by the policy.
func (AccessPolicy) AddPublicKeyPolicy ¶
func (ap AccessPolicy) AddPublicKeyPolicy(policy *accessctl.Policy, pubKey signature.PublicKey)
AddPublicKeyPolicy augments the given policy by allowing actions in the current AccessPolicy to given TLS public key.
func (AccessPolicy) AddRulesForCommittee ¶
func (ap AccessPolicy) AddRulesForCommittee(policy *accessctl.Policy, committee *CommitteeInfo, nodes nodes.NodeDescriptorLookup)
AddRulesForCommittee augments the given policy by allowing actions in the current AccessPolicy for the nodes in the given committee.
func (AccessPolicy) AddRulesForNodeRoles ¶
func (ap AccessPolicy) AddRulesForNodeRoles( policy *accessctl.Policy, nodes []*node.Node, roles node.RolesMask, )
AddRulesForNodeRoles augments the given policy by allowing actions in the current AccessPolicy for the nodes that have the given roles mask.
type CommitteeInfo ¶
type CommitteeInfo struct { Roles []scheduler.Role Committee *scheduler.Committee PublicKeys map[signature.PublicKey]bool }
CommitteeInfo contains information about a committee of nodes.
type EpochSnapshot ¶
type EpochSnapshot struct {
// contains filtered or unexported fields
}
EpochSnapshot is an immutable snapshot of epoch state.
func (*EpochSnapshot) GetEpochNumber ¶
func (e *EpochSnapshot) GetEpochNumber() beacon.EpochTime
GetEpochNumber returns the sequential number of the epoch.
func (*EpochSnapshot) GetExecutorCommittee ¶ added in v0.2010.0
func (e *EpochSnapshot) GetExecutorCommittee() *CommitteeInfo
GetExecutorCommittee returns the current executor committee.
func (*EpochSnapshot) GetGroupVersion ¶
func (e *EpochSnapshot) GetGroupVersion() int64
GetGroupVersion returns the consensus backend block height of the last processed committee election.
func (*EpochSnapshot) GetRuntime ¶
func (e *EpochSnapshot) GetRuntime() *registry.Runtime
GetRuntime returns the current runtime descriptor.
func (*EpochSnapshot) GetStorageCommittee ¶
func (e *EpochSnapshot) GetStorageCommittee() *CommitteeInfo
GetStorageCommittee returns the current storage committee.
func (*EpochSnapshot) IsExecutorBackupWorker ¶
func (e *EpochSnapshot) IsExecutorBackupWorker() bool
IsExecutorBackupWorker checks if the current node is a backup worker of the executor committee in the current epoch.
func (*EpochSnapshot) IsExecutorMember ¶
func (e *EpochSnapshot) IsExecutorMember() bool
IsExecutorMember checks if the current node is a member of the executor committee in the current epoch.
func (*EpochSnapshot) IsExecutorWorker ¶
func (e *EpochSnapshot) IsExecutorWorker() bool
IsExecutorWorker checks if the current node is a worker of the executor committee in the current epoch.
func (*EpochSnapshot) IsTransactionScheduler ¶ added in v0.2010.0
func (e *EpochSnapshot) IsTransactionScheduler(round uint64) bool
IsTransactionScheduler checks if the current node is a a transaction scheduler at the specific runtime round.
func (*EpochSnapshot) Nodes ¶
func (e *EpochSnapshot) Nodes() nodes.NodeDescriptorLookup
Nodes returns a node descriptor lookup interface.
func (*EpochSnapshot) VerifyCommitteeSignatures ¶
func (e *EpochSnapshot) VerifyCommitteeSignatures(kind scheduler.CommitteeKind, sigs []signature.Signature) error
VerifyCommitteeSignatures verifies that the given signatures come from the current committee members of the given kind.
Implements commitment.SignatureVerifier.
func (*EpochSnapshot) VerifyTxnSchedulerSigner ¶ added in v0.2100.0
func (e *EpochSnapshot) VerifyTxnSchedulerSigner(sig signature.Signature, round uint64) error
VerifyTxnSchedulerSigner verifies that the given signature comes from the transaction scheduler at provided round.
Implements commitment.SignatureVerifier.
type Group ¶
Group encapsulates communication with a group of nodes in the runtime committees.
func NewGroup ¶
func NewGroup( ctx context.Context, identity *identity.Identity, runtime runtimeRegistry.Runtime, handler MessageHandler, consensus consensus.Backend, p2p *p2p.P2P, ) (*Group, error)
NewGroup creates a new group.
func (*Group) AuthenticatePeer ¶
AuthenticatePeer handles authenticating a peer that send an incoming message.
func (*Group) EpochTransition ¶
EpochTransition processes an epoch transition that just happened.
func (*Group) GetEpochSnapshot ¶
func (g *Group) GetEpochSnapshot() *EpochSnapshot
GetEpochSnapshot returns a snapshot of the currently active epoch.
func (*Group) HandlePeerMessage ¶
func (g *Group) HandlePeerMessage(unusedPeerID signature.PublicKey, msg *p2p.Message, isOwn bool) error
HandlePeerMessage handles an incoming message from a peer.
func (*Group) Nodes ¶
func (g *Group) Nodes() nodes.NodeDescriptorLookup
Nodes returns a node descriptor lookup interface that watches all nodes in our committees.
func (*Group) RoundTransition ¶
func (g *Group) RoundTransition()
RoundTransition processes a round transition that just happened.
func (*Group) Storage ¶ added in v0.2010.0
Storage returns the storage client backend that talks to the runtime group.
func (*Group) StorageLocal ¶ added in v0.2102.7
func (g *Group) StorageLocal() storage.LocalBackend
StorageLocal returns the local storage backend if the local node is also a storage node. Otherwise it returns nil.
type MessageHandler ¶
type MessageHandler interface { // HandlePeerMessage handles a message that has already been authenticated to come from a // registered node. // // The provided context is short-lived so if the handler needs to perform additional work, that // should be dispatched to a separate goroutine and not block delivery. HandlePeerMessage(ctx context.Context, msg *p2p.Message, isOwn bool) error }
MessageHandler handles messages from other nodes.
type Node ¶
type Node struct { Runtime runtimeRegistry.Runtime HostNode control.ControlledNode Identity *identity.Identity KeyManager keymanagerApi.Backend KeyManagerClient *keymanagerClient.Client Consensus consensus.Backend Group *Group // Mutable and shared between nodes' workers. // Guarded by .CrossNode. CrossNode sync.Mutex CurrentBlock *block.Block CurrentBlockHeight int64 CurrentConsensusBlock *consensus.LightBlock Height int64 // contains filtered or unexported fields }
Node is a committee node.
func NewNode ¶
func NewNode( hostNode control.ControlledNode, runtime runtimeRegistry.Runtime, identity *identity.Identity, keymanager keymanagerApi.Backend, consensus consensus.Backend, p2p *p2p.P2P, ) (*Node, error)
func (*Node) Cleanup ¶
func (n *Node) Cleanup()
Cleanup performs the service specific post-termination cleanup.
func (*Node) GetRuntime ¶
func (n *Node) GetRuntime() runtimeRegistry.Runtime
Implements RuntimeHostHandlerFactory.
func (*Node) HandlePeerMessage ¶
HandlePeerMessage forwards a message from the group system to our hooks.
func (*Node) Initialized ¶
func (n *Node) Initialized() <-chan struct{}
Initialized returns a channel that will be closed when the node is initialized and ready to service requests.
func (*Node) NewNotifier ¶
Implements RuntimeHostHandlerFactory.
func (*Node) NewRuntimeHostHandler ¶
Implements RuntimeHostHandlerFactory.
type NodeHooks ¶
type NodeHooks interface { HandlePeerMessage(context.Context, *p2p.Message, bool) (bool, error) // Guarded by CrossNode. HandleEpochTransitionLocked(*EpochSnapshot) // Guarded by CrossNode. HandleNewBlockEarlyLocked(*block.Block) // Guarded by CrossNode. HandleNewBlockLocked(*block.Block) // Guarded by CrossNode. HandleNewEventLocked(*roothash.Event) // Guarded by CrossNode. HandleNodeUpdateLocked(*nodes.NodeUpdate, *EpochSnapshot) // Initialized returns a channel that will be closed when the worker is initialized and ready // to service requests. Initialized() <-chan struct{} }
NodeHooks defines a worker's duties at common events. These are called from the runtime's common node's worker.