state

package
v1.22.46 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrVertexNotFound = &vertexNotFoundError{}

ErrVertexNotFound is returned when vertex not found

Functions

This section is empty.

Types

type DAGVM added in v1.22.46

type DAGVM interface {
	// ParseVtx parses a vertex from bytes
	ParseVtx(ctx context.Context, bytes []byte) (Vertex, error)
}

DAGVM is the interface for a DAG-based virtual machine

type Manager added in v1.22.46

type Manager interface {
	State

	// ParseVtx parses a vertex from bytes
	ParseVtx(ctx context.Context, bytes []byte) (Vertex, error)

	// GetVtx returns a vertex by ID
	GetVtx(ctx context.Context, vtxID ids.ID) (Vertex, error)

	// Edge returns the current edge of the DAG
	Edge(ctx context.Context) []ids.ID

	// StopVertexAccepted marks a vertex as no longer accepted
	StopVertexAccepted()
}

Manager extends State with vertex management capabilities

func NewSerializer added in v1.22.46

func NewSerializer(config SerializerConfig) Manager

NewSerializer creates a new vertex serializer/manager

type SerializerConfig added in v1.22.46

type SerializerConfig struct {
	ChainID ids.ID
	VM      DAGVM
	DB      database.Database
	Log     log.Logger
}

SerializerConfig configures the vertex serializer

type State

type State interface {
	// GetVertex gets a vertex
	GetVertex(ids.ID) (Vertex, error)

	// AddVertex adds a vertex
	AddVertex(Vertex) error

	// VertexIssued checks if vertex issued
	VertexIssued(Vertex) bool

	// IsProcessing checks if processing
	IsProcessing(ids.ID) bool
}

State represents DAG state

func New

func New() State

New creates a new state

type Vertex

type Vertex interface {
	ID() ids.ID
	ParentIDs() []ids.ID
	Height() uint64
	Bytes() []byte
}

Vertex represents a DAG vertex

Jump to

Keyboard shortcuts

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