Help us shape the future of Go! Take the 2026 Go Developer Survey

vertex

package
v1.14.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAGVM

type DAGVM interface {
	LinearizableVM
}

DAGVM defines a DAG-based VM interface

type LinearizableVM

type LinearizableVM interface {
	// ParseVertex parses a vertex from bytes
	ParseVertex(context.Context, []byte) (Vertex, error)

	// BuildVertex builds a new vertex
	BuildVertex(context.Context) (Vertex, error)
}

LinearizableVM defines a VM that can produce linearizable vertices

type LinearizableVMWithEngine

type LinearizableVMWithEngine interface {
	LinearizableVM

	// GetEngine returns the consensus engine
	GetEngine() interface{}
}

LinearizableVMWithEngine is a LinearizableVM with engine

type LinearizableVMWithLinearize

type LinearizableVMWithLinearize interface {
	// Linearize linearizes the VM at the given stop vertex
	Linearize(ctx context.Context, stopVertexID ids.ID) error
}

LinearizableVMWithLinearize is a VM that can be linearized

type LinearizableVertex

type LinearizableVertex interface {
	Vertex

	// Linearize returns a linear ordering of operations contained in this vertex
	Linearize(context.Context) error
}

LinearizableVertex is a vertex that can be linearized

type Manager

type Manager interface {
	Storage

	// Add a vertex to the manager
	Add(context.Context, Vertex) error

	// Get the vertex with the given ID
	Get(context.Context, ids.ID) (Vertex, error)

	// GetAncestors returns the ancestors of the given vertex
	GetAncestors(context.Context, ids.ID) ([]Vertex, error)

	// Edge returns the edge vertices
	Edge(context.Context) []ids.ID

	// StopVertex stops vertex with given ID
	StopVertex(context.Context, ids.ID) error
}

Manager manages vertex operations

type Storage

type Storage interface {
	// GetVertex returns the vertex with the given ID
	GetVertex(ctx context.Context, vertexID ids.ID) (Vertex, error)

	// StoreVertex stores a vertex
	StoreVertex(ctx context.Context, vertex Vertex) error

	// RemoveVertex removes a vertex from storage
	RemoveVertex(ctx context.Context, vertexID ids.ID) error

	// VertexIDs returns all vertex IDs in storage
	VertexIDs(ctx context.Context) ([]ids.ID, error)
}

Storage defines the storage interface for vertices

type Vertex

type Vertex interface {
	choices.Decidable

	// Parents returns the vertices this vertex depends on
	Parents() ([]ids.ID, error)

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

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

	// Timestamp returns the time this vertex was created
	Timestamp() int64

	// Verify that this vertex is well-formed
	Verify(context.Context) error

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

Vertex is a basic vertex interface

Directories

Path Synopsis
Package vertexmock is a generated GoMock package.
Package vertexmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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