avalanche

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapConfig

type BootstrapConfig struct {
	common.Config

	// VtxBlocked tracks operations that are blocked on vertices
	// TxBlocked tracks operations that are blocked on transactions
	VtxBlocked, TxBlocked *queue.Jobs

	State State
	VM    DAGVM
}

BootstrapConfig ...

type Config

type Config struct {
	BootstrapConfig

	Params    avalanche.Parameters
	Consensus avalanche.Consensus
}

Config wraps all the parameters needed for an avalanche engine

type DAGVM

type DAGVM interface {
	common.VM

	// Return any transactions that have not been sent to consensus yet
	PendingTxs() []snowstorm.Tx

	// Convert a stream of bytes to a transaction or return an error
	ParseTx(tx []byte) (snowstorm.Tx, error)

	// Retrieve a transaction that was submitted previously
	GetTx(ids.ID) (snowstorm.Tx, error)
}

DAGVM defines the minimum functionality that an avalanche VM must implement

type Engine

type Engine interface {
	common.Engine

	// Initialize this engine.
	Initialize(Config)
}

Engine describes the events that can occur on a consensus instance

type State

type State interface {
	// Create a new vertex from the contents of a vertex
	BuildVertex(parentIDs ids.Set, txs []snowstorm.Tx) (avalanche.Vertex, error)

	// Attempt to convert a stream of bytes into a vertex
	ParseVertex(vertex []byte) (avalanche.Vertex, error)

	// GetVertex attempts to load a vertex by hash from storage
	GetVertex(vtxID ids.ID) (avalanche.Vertex, error)

	// Edge returns a list of accepted vertex IDs with no accepted children
	Edge() (vtxIDs []ids.ID)
}

State defines the persistant storage that is required by the consensus engine

type Transitive

type Transitive struct {
	Config
	// contains filtered or unexported fields
}

Transitive implements the Engine interface by attempting to fetch all transitive dependencies.

func (*Transitive) Chits

func (t *Transitive) Chits(vdr ids.ShortID, requestID uint32, votes ids.Set)

Chits implements the Engine interface

func (*Transitive) Context

func (t *Transitive) Context() *snow.Context

Context implements the Engine interface

func (*Transitive) CurrentAcceptedFrontier

func (b *Transitive) CurrentAcceptedFrontier() ids.Set

CurrentAcceptedFrontier ...

func (*Transitive) FilterAccepted

func (b *Transitive) FilterAccepted(containerIDs ids.Set) ids.Set

FilterAccepted ...

func (*Transitive) ForceAccepted

func (b *Transitive) ForceAccepted(acceptedContainerIDs ids.Set)

ForceAccepted ...

func (*Transitive) Get

func (t *Transitive) Get(vdr ids.ShortID, requestID uint32, vtxID ids.ID)

Get implements the Engine interface

func (*Transitive) GetFailed

func (t *Transitive) GetFailed(vdr ids.ShortID, requestID uint32, vtxID ids.ID)

GetFailed implements the Engine interface

func (*Transitive) Initialize

func (t *Transitive) Initialize(config Config)

Initialize implements the Engine interface

func (*Transitive) Notify

func (t *Transitive) Notify(msg common.Message)

Notify implements the Engine interface

func (*Transitive) PullQuery

func (t *Transitive) PullQuery(vdr ids.ShortID, requestID uint32, vtxID ids.ID)

PullQuery implements the Engine interface

func (*Transitive) PushQuery

func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, vtxID ids.ID, vtx []byte)

PushQuery implements the Engine interface

func (*Transitive) Put

func (t *Transitive) Put(vdr ids.ShortID, requestID uint32, vtxID ids.ID, vtxBytes []byte)

Put implements the Engine interface

func (*Transitive) QueryFailed

func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32)

QueryFailed implements the Engine interface

func (*Transitive) Shutdown

func (t *Transitive) Shutdown()

Shutdown implements the Engine interface

type VMTest

type VMTest struct {
	common.VMTest

	CantPendingTxs, CantParseTx, CantIssueTx, CantGetTx bool

	PendingTxsF func() []snowstorm.Tx
	ParseTxF    func([]byte) (snowstorm.Tx, error)
	IssueTxF    func([]byte, func(choices.Status), func(choices.Status)) (ids.ID, error)
	GetTxF      func(ids.ID) (snowstorm.Tx, error)
}

VMTest ...

func (*VMTest) Default

func (vm *VMTest) Default(cant bool)

Default ...

func (*VMTest) GetTx

func (vm *VMTest) GetTx(txID ids.ID) (snowstorm.Tx, error)

GetTx ...

func (*VMTest) IssueTx

func (vm *VMTest) IssueTx(b []byte, issued, finalized func(choices.Status)) (ids.ID, error)

IssueTx ...

func (*VMTest) ParseTx

func (vm *VMTest) ParseTx(b []byte) (snowstorm.Tx, error)

ParseTx ...

func (*VMTest) PendingTxs

func (vm *VMTest) PendingTxs() []snowstorm.Tx

PendingTxs ...

Directories

Path Synopsis
Package state manages the meta-data required by consensus for an avalanche dag.
Package state manages the meta-data required by consensus for an avalanche dag.

Jump to

Keyboard shortcuts

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