Documentation
¶
Index ¶
- Constants
- type AppError
- type AppHandler
- type AppSender
- type AppSenderOriginal
- type Block
- type BlockStatus
- type CGOConsensus
- func (c *CGOConsensus) Add(block Block) error
- func (c *CGOConsensus) Finalized() bool
- func (c *CGOConsensus) GetPreference() ids.ID
- func (c *CGOConsensus) HealthCheck() error
- func (c *CGOConsensus) IsAccepted(blockID ids.ID) bool
- func (c *CGOConsensus) Parameters() ConsensusParams
- func (c *CGOConsensus) RecordPoll(blockID ids.ID, accept bool) error
- type Consensus
- type ConsensusFactory
- type ConsensusParams
- type FakeSender
- type Fx
- type MessageType
- type SendConfig
- type SenderTest
- type Stats
Constants ¶
const (
PendingTxs = common.PendingTxs
)
Message constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppHandler ¶
type AppHandler = consensus_core.AppHandler
AppHandler handles application messages
type AppSender ¶
type AppSender = consensus_core.AppSender
AppSender is a type alias for the core AppSender
type AppSenderOriginal ¶
type AppSenderOriginal interface {
// SendAppRequest sends an application-level request to the given nodes
SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, request []byte) error
// SendAppResponse sends an application-level response to the given node
SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
// SendAppGossip sends an application-level gossip message
SendAppGossip(ctx context.Context, nodeIDs set.Set[ids.NodeID], message []byte) error
// SendCrossChainAppRequest sends a cross-chain app request
SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, request []byte) error
// SendCrossChainAppResponse sends a cross-chain app response
SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
// SendCrossChainAppError sends a cross-chain app error
SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) error
// SendAppError sends an application-level error response to the given node
SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error
}
AppSenderOriginal sends application-level messages
type Block ¶
type Block interface {
ID() ids.ID
ParentID() ids.ID
Height() uint64
Timestamp() int64
Bytes() []byte
Verify(context.Context) error
Accept(context.Context) error
Reject(context.Context) error
}
Block interface for consensus
type BlockStatus ¶
type BlockStatus uint8
BlockStatus represents block status
const ( StatusUnknown BlockStatus = iota StatusProcessing StatusAccepted StatusRejected )
type CGOConsensus ¶
type CGOConsensus struct {
// contains filtered or unexported fields
}
CGOConsensus is a CGO-based implementation of consensus For now, it's the same as the pure Go implementation
func NewCGOConsensus ¶
func NewCGOConsensus(params ConsensusParams) (*CGOConsensus, error)
NewCGOConsensus creates a new CGO consensus engine
func (*CGOConsensus) Add ¶
func (c *CGOConsensus) Add(block Block) error
Add adds a block to consensus
func (*CGOConsensus) Finalized ¶
func (c *CGOConsensus) Finalized() bool
Finalized checks if consensus is finalized
func (*CGOConsensus) GetPreference ¶
func (c *CGOConsensus) GetPreference() ids.ID
GetPreference returns the current preference
func (*CGOConsensus) HealthCheck ¶
func (c *CGOConsensus) HealthCheck() error
HealthCheck performs a health check
func (*CGOConsensus) IsAccepted ¶
func (c *CGOConsensus) IsAccepted(blockID ids.ID) bool
IsAccepted checks if a block is accepted
func (*CGOConsensus) Parameters ¶
func (c *CGOConsensus) Parameters() ConsensusParams
Parameters returns consensus parameters
func (*CGOConsensus) RecordPoll ¶
func (c *CGOConsensus) RecordPoll(blockID ids.ID, accept bool) error
RecordPoll records a poll result
type Consensus ¶
type Consensus interface {
Add(Block) error
RecordPoll(ids.ID, bool) error
IsAccepted(ids.ID) bool
GetPreference() ids.ID
Finalized() bool
Parameters() ConsensusParams
HealthCheck() error
}
Consensus interface
type ConsensusFactory ¶
type ConsensusFactory struct{}
ConsensusFactory creates the appropriate consensus implementation This is the CGO version when CGO is enabled
func NewConsensusFactory ¶
func NewConsensusFactory() *ConsensusFactory
NewConsensusFactory creates a new consensus factory
func (*ConsensusFactory) CreateConsensus ¶
func (f *ConsensusFactory) CreateConsensus(params ConsensusParams) (Consensus, error)
CreateConsensus creates a consensus engine instance
type ConsensusParams ¶
type ConsensusParams struct {
K int
AlphaPreference int
AlphaConfidence int
Beta int
ConcurrentPolls int
OptimalProcessing int
MaxOutstandingItems int
MaxItemProcessingTime time.Duration
}
ConsensusParams defines consensus parameters
type FakeSender ¶
type FakeSender = consensus_core.FakeSender
FakeSender is a type alias for the core FakeSender
type SendConfig ¶
type SendConfig = consensus_core.SendConfig
SendConfig is a type alias for the core SendConfig
type SenderTest ¶
type SenderTest struct {
FakeSender
}
SenderTest is a test implementation of AppSender
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package coremock provides mock implementations for core consensus
|
Package coremock provides mock implementations for core consensus |