interfaces

package
v1.22.45 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 4 Imported by: 8

Documentation

Overview

Package interfaces defines core consensus interfaces

Package interfaces defines core consensus interfaces.

Index

Constants

View Source
const (
	Unknown       = vm.Unknown
	Starting      = vm.Starting
	Syncing       = vm.Syncing
	Bootstrapping = vm.Bootstrapping
	Ready         = vm.Ready
	Degraded      = vm.Degraded
	Stopping      = vm.Stopping
	Stopped       = vm.Stopped
)

Re-export State constants from vm package

Variables

This section is empty.

Functions

This section is empty.

Types

type BCLookup added in v1.21.0

type BCLookup interface {
	Lookup(alias string) (ids.ID, error)
	GetAlias(blockchainID ids.ID) (string, error)
	GetBlockchainID(alias string) (ids.ID, error)
	PrimaryAlias(blockchainID ids.ID) (string, error)
	Aliases(blockchainID ids.ID) ([]string, error)
}

BCLookup provides blockchain lookup functionality

type Block

type Block interface {
	// ID returns the block's unique identifier
	ID() ids.ID

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

	// Height returns the block's height
	Height() uint64

	// Bytes returns the serialized block
	Bytes() []byte

	// Accept marks the block as accepted
	Accept(context.Context) error

	// Reject marks the block as rejected
	Reject(context.Context) error
}

Block represents a consensus block

type ChainState added in v1.22.31

type ChainState interface {
	// GetBlock retrieves a block by its ID
	GetBlock(ctx context.Context, blockID ids.ID) (Block, error)

	// PutBlock stores a block
	PutBlock(ctx context.Context, block Block) error

	// GetLastAccepted returns the last accepted block ID
	GetLastAccepted(ctx context.Context) (ids.ID, error)

	// SetLastAccepted sets the last accepted block ID
	SetLastAccepted(ctx context.Context, blockID ids.ID) error
}

ChainState represents the state of the consensus chain

type SharedMemory added in v1.21.0

type SharedMemory interface {
	GetDatabase(id ids.ID) (*VersionedDatabase, database.Database)
	ReleaseDatabase(id ids.ID) error
}

SharedMemory provides shared memory functionality

type State

type State = vm.State

State is the VM lifecycle state, aliased from vm.State

type VM added in v1.22.31

type VM interface {
	// Shutdown is called when the node is shutting down
	Shutdown(context.Context) error
}

VM defines the common VM interface for consensus engines

type VersionedDatabase added in v1.21.0

type VersionedDatabase struct {
	Lock   database.Database
	Memory database.Database
}

VersionedDatabase provides versioned database access

Jump to

Keyboard shortcuts

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