common

package
v1.13.6-lux Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block added in v0.1.1

type Block interface {
	Decidable

	// Parent returns the ID of this block's parent
	Parent() ids.ID

	// Height returns the height of this block
	Height() uint64

	// Timestamp returns the time this block was created
	Timestamp() uint64

	// Verify that the state transition this block would make is valid
	Verify() error

	// Bytes returns the binary representation of this block
	Bytes() []byte
}

Block defines the common interface for all blocks

type Decidable added in v0.1.1

type Decidable interface {
	// ID returns the unique ID of this element
	ID() ids.ID

	// Accept accepts this element and changes its status to Accepted
	Accept() error

	// Reject rejects this element and changes its status to Rejected
	Reject() error

	// Status returns the current status
	Status() choices.Status
}

Decidable represents an element that can be decided

type Engine

type Engine interface {
	// Start the engine
	Start(uint64) error

	// Stop the engine
	Stop() error

	// HealthCheck returns nil if the engine is healthy
	HealthCheck() (interface{}, error)
}

Engine defines the common interface for consensus engines

type EngineState added in v0.1.1

type EngineState uint32

EngineState represents the state of a consensus engine

const (
	// Initializing state
	Initializing EngineState = iota
	// Bootstrapping state
	Bootstrapping
	// NormalOp state - normal operation
	NormalOp
	// Stopped state
	Stopped
)

func (EngineState) String added in v0.1.1

func (s EngineState) String() string

String returns the string representation of the engine state

type Handler

type Handler interface {
	Engine

	// SetState sets the state of the handler
	SetState(EngineState) error

	// GetState returns the current state
	GetState() EngineState
}

Handler defines the interface for handling consensus messages

type Sender

type Sender interface {
	// SendGetAcceptedFrontier sends a GetAcceptedFrontier message
	SendGetAcceptedFrontier(nodeID ids.NodeID, requestID uint32)

	// SendAcceptedFrontier sends an AcceptedFrontier message
	SendAcceptedFrontier(nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID)

	// SendGetAccepted sends a GetAccepted message
	SendGetAccepted(nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID)

	// SendAccepted sends an Accepted message
	SendAccepted(nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID)

	// SendGet sends a Get message
	SendGet(nodeID ids.NodeID, requestID uint32, containerID ids.ID)

	// SendPut sends a Put message
	SendPut(nodeID ids.NodeID, requestID uint32, container []byte)

	// SendPushQuery sends a PushQuery message
	SendPushQuery(nodeIDs []ids.NodeID, requestID uint32, container []byte)

	// SendPullQuery sends a PullQuery message
	SendPullQuery(nodeIDs []ids.NodeID, requestID uint32, containerID ids.ID)

	// SendChits sends a Chits message
	SendChits(nodeID ids.NodeID, requestID uint32, votes []ids.ID)
}

Sender defines the interface for sending consensus messages

type Vertex added in v0.1.1

type Vertex interface {
	Decidable

	// Parents returns the IDs of this vertex's parents
	Parents() []ids.ID

	// Height returns the height of this vertex
	Height() uint64

	// Epoch returns the epoch this vertex was created in
	Epoch() uint32

	// Verify that the state transition this vertex would make is valid
	Verify() error

	// Bytes returns the binary representation of this vertex
	Bytes() []byte
}

Vertex defines the common interface for all vertices

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL