Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnknownState = errors.New("unknown state")
Functions ¶
This section is empty.
Types ¶
type Acceptor ¶ added in v1.7.3
type Acceptor interface {
// Accept must be called before [containerID] is committed to the VM as
// accepted.
//
// If the returned error is non-nil, the chain associated with [ctx] should
// shut down and not commit [container] or any other container to its
// database as accepted.
Accept(ctx *ConsensusContext, containerID ids.ID, container []byte) error
}
Acceptor is implemented when a struct is monitoring if a message is accepted
type AcceptorGroup ¶ added in v1.7.11
type AcceptorGroup interface {
// Calling Accept() calls all of the registered acceptors for the relevant
// chain.
Acceptor
// RegisterAcceptor causes [acceptor] to be called every time an operation
// is accepted on chain [chainID].
// If [dieOnError], chain [chainID] stops if Accept returns a non-nil error.
RegisterAcceptor(chainID ids.ID, acceptorName string, acceptor Acceptor, dieOnError bool) error
// DeregisterAcceptor removes an acceptor from the group.
DeregisterAcceptor(chainID ids.ID, acceptorName string) error
}
func NewAcceptorGroup ¶ added in v1.7.11
func NewAcceptorGroup(log logging.Logger) AcceptorGroup
type ConsensusContext ¶ added in v1.7.0
type ConsensusContext struct {
*Context
// PrimaryAlias is the primary alias of the chain this context exists
// within.
PrimaryAlias string
// Registers all consensus metrics.
Registerer Registerer
// BlockAcceptor is the callback that will be fired whenever a VM is
// notified that their block was accepted.
BlockAcceptor Acceptor
// TxAcceptor is the callback that will be fired whenever a VM is notified
// that their transaction was accepted.
TxAcceptor Acceptor
// VertexAcceptor is the callback that will be fired whenever a vertex was
// accepted.
VertexAcceptor Acceptor
// State indicates the current state of this consensus instance.
State utils.Atomic[EngineState]
// True iff this chain is executing transactions as part of bootstrapping.
Executing utils.Atomic[bool]
// True iff this chain is currently state-syncing
StateSyncing utils.Atomic[bool]
}
type Context ¶
type Context struct {
NetworkID uint32
SubnetID ids.ID
ChainID ids.ID
NodeID ids.NodeID
PublicKey *bls.PublicKey
NetworkUpgrades upgrade.Config
XChainID ids.ID
CChainID ids.ID
AVAXAssetID ids.ID
Log logging.Logger
Lock sync.RWMutex
Keystore keystore.BlockchainKeystore
BCLookup ids.AliaserReader
Metrics metrics.MultiGatherer
WarpSigner warp.Signer
// snowman++ attributes
ValidatorState validators.State // interface for P-Chain validators
// Chain-specific directory where arbitrary data can be written
ChainDataDir string
}
Context is information about the current execution. [NetworkID] is the ID of the network this context exists within. [ChainID] is the ID of the chain this context exists within. [NodeID] is the ID of this node
type ContextInitializable ¶ added in v1.4.12
type ContextInitializable interface {
// InitCtx initializes an object provided a *Context object
InitCtx(ctx *Context)
}
ContextInitializable represents an object that can be initialized given a *Context object
type Decidable ¶ added in v1.11.10
type Decidable interface {
// ID returns a unique ID for this element.
//
// Typically, this is implemented by using a cryptographic hash of a
// binary representation of this element. An element should return the same
// IDs upon repeated calls.
ID() ids.ID
// Accept this element.
//
// This element will be accepted by every correct node in the network.
Accept(context.Context) error
// Reject this element.
//
// This element will not be accepted by any correct node in the network.
Reject(context.Context) error
}
Decidable represents element that can be decided.
Decidable objects are typically thought of as either transactions, blocks, or vertices.
type EngineState ¶ added in v1.9.8
type EngineState struct {
Type p2p.EngineType
State State
}
type Registerer ¶ added in v1.7.14
type Registerer interface {
prometheus.Registerer
prometheus.Gatherer
}
Expose gatherer interface for unit testing.
Directories
¶
| Path | Synopsis |
|---|---|
|
consensus
|
|
|
snowman/snowmanmock
Package snowmanmock is a generated GoMock package.
|
Package snowmanmock is a generated GoMock package. |
|
engine
|
|
|
avalanche/state
Package state manages the meta-data required by consensus for an avalanche dag.
|
Package state manages the meta-data required by consensus for an avalanche dag. |
|
avalanche/vertex/vertexmock
Package vertexmock is a generated GoMock package.
|
Package vertexmock is a generated GoMock package. |
|
common/commonmock
Package commonmock is a generated GoMock package.
|
Package commonmock is a generated GoMock package. |
|
snowman/block/blockmock
Package blockmock is a generated GoMock package.
|
Package blockmock is a generated GoMock package. |
|
snowman/job
Package job provides a Scheduler to manage and execute Jobs with dependencies.
|
Package job provides a Scheduler to manage and execute Jobs with dependencies. |
|
networking
|
|
|
handler/handlermock
Package handlermock is a generated GoMock package.
|
Package handlermock is a generated GoMock package. |
|
router/routermock
Package routermock is a generated GoMock package.
|
Package routermock is a generated GoMock package. |
|
sender/sendermock
Package sendermock is a generated GoMock package.
|
Package sendermock is a generated GoMock package. |
|
timeout/timeoutmock
Package timeoutmock is a generated GoMock package.
|
Package timeoutmock is a generated GoMock package. |
|
tracker/trackermock
Package trackermock is a generated GoMock package.
|
Package trackermock is a generated GoMock package. |
|
uptimemock
Package uptimemock is a generated GoMock package.
|
Package uptimemock is a generated GoMock package. |
|
validatorsmock
Package validatorsmock is a generated GoMock package.
|
Package validatorsmock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.