choices

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: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decidable

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

	// Accept this element.
	Accept() error

	// Reject this element.
	Reject() error

	// Status returns the current status of this element.
	Status() Status
}

Decidable represents an element that can be decided.

type Status

type Status uint32

Status represents the current status of a block or vertex

const (
	// Unknown indicates the status is not known
	Unknown Status = iota
	// Processing indicates the element is being processed
	Processing
	// Accepted indicates the element was accepted
	Accepted
	// Rejected indicates the element was rejected
	Rejected
	// Dropped indicates the element was dropped
	Dropped
	// Quantum indicates the element is in quantum consensus state
	Quantum
)

func (Status) Decided

func (s Status) Decided() bool

Decided returns true if the status implies a decision has been made.

func (Status) Fetched

func (s Status) Fetched() bool

Fetched returns true if the status implies the block has been fetched.

func (Status) IsQuantum

func (s Status) IsQuantum() bool

IsQuantum returns true if the status is Quantum.

func (Status) MarshalJSON added in v1.14.2

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON marshals the status as a string.

func (Status) String

func (s Status) String() string

String returns a human-readable string for this status.

func (Status) Valid

func (s Status) Valid() bool

Valid returns true if the status is a valid status.

type TestDecidable

type TestDecidable struct {
	IDV     string
	AcceptV error
	RejectV error
	StatusV Status
}

TestDecidable is a test implementation of Decidable.

func (*TestDecidable) Accept

func (d *TestDecidable) Accept() error

func (*TestDecidable) ID

func (d *TestDecidable) ID() string

func (*TestDecidable) Reject

func (d *TestDecidable) Reject() error

func (*TestDecidable) Status

func (d *TestDecidable) Status() Status

Jump to

Keyboard shortcuts

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