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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consensus

type Consensus interface {
	// Takes in alpha, beta1, beta2, the accepted frontier, the join statuses,
	// the mutation statuses, and the consumer statuses. If accept or reject is
	// called, the status maps should be immediately updated accordingly.
	// Assumes each element in the accepted frontier will return accepted from
	// the join status map.
	Initialize(*snow.Context, Parameters, []Vertex)

	// Returns the parameters that describe this avalanche instance
	Parameters() Parameters

	// Returns true if the transaction is virtuous.
	// That is, no transaction has been added that conflicts with it
	IsVirtuous(snowstorm.Tx) bool

	// Adds a new decision. Assumes the dependencies have already been added.
	// Assumes that mutations don't conflict with themselves.
	Add(Vertex)

	// VertexIssued returns true iff Vertex has been added
	VertexIssued(Vertex) bool

	// TxIssued returns true if a vertex containing this transanction has been added
	TxIssued(snowstorm.Tx) bool

	// Returns the set of transaction IDs that are virtuous but not contained in
	// any preferred vertices.
	Orphans() ids.Set

	// Returns a set of vertex IDs that were virtuous at the last update.
	Virtuous() ids.Set

	// Returns a set of vertex IDs that are preferred
	Preferences() ids.Set

	// RecordPoll collects the results of a network poll. If a result has not
	// been added, the result is dropped.
	RecordPoll(ids.UniqueBag)

	// Quiesce returns true iff all vertices that have been added but not been accepted or rejected are rogue.
	// Note, it is possible that after returning quiesce, a new decision may be added such
	// that this instance should no longer quiesce.
	Quiesce() bool

	// Finalized returns true if all transactions that have been added have been
	// finalized. Note, it is possible that after returning finalized, a new
	// decision may be added such that this instance is no longer finalized.
	Finalized() bool
}

Consensus represents a general avalanche instance that can be used directly to process a series of partially ordered elements.

type Factory

type Factory interface {
	New() Consensus
}

Factory returns new instances of Consensus

type Parameters

type Parameters struct {
	snowball.Parameters
	Parents, BatchSize int
}

Parameters the avalanche paramaters include the snowball paramters and the optimal number of parents

func (Parameters) Valid

func (p Parameters) Valid() error

Valid returns nil if the parameters describe a valid initialization.

type Topological

type Topological struct {
	// contains filtered or unexported fields
}

Topological performs the avalanche algorithm by utilizing a topological sort of the voting results. Assumes that vertices are inserted in topological order.

func (*Topological) Accepted

func (m *Topological) Accepted(id ids.ID)

func (*Topological) Add

func (ta *Topological) Add(vtx Vertex)

Add implements the Avalanche interface

func (*Topological) Finalized

func (ta *Topological) Finalized() bool

Finalized implements the Avalanche interface

func (*Topological) Initialize

func (ta *Topological) Initialize(ctx *snow.Context, params Parameters, frontier []Vertex)

Initialize implements the Avalanche interface

func (*Topological) IsVirtuous

func (ta *Topological) IsVirtuous(tx snowstorm.Tx) bool

IsVirtuous implements the Avalanche interface

func (*Topological) Issued

func (m *Topological) Issued(id ids.ID)

func (*Topological) Orphans

func (ta *Topological) Orphans() ids.Set

Orphans implements the Avalanche interface

func (*Topological) Parameters

func (ta *Topological) Parameters() Parameters

Parameters implements the Avalanche interface

func (*Topological) Preferences

func (ta *Topological) Preferences() ids.Set

Preferences implements the Avalanche interface

func (*Topological) Quiesce

func (ta *Topological) Quiesce() bool

Quiesce implements the Avalanche interface

func (*Topological) RecordPoll

func (ta *Topological) RecordPoll(responses ids.UniqueBag)

RecordPoll implements the Avalanche interface

func (*Topological) Rejected

func (m *Topological) Rejected(id ids.ID)

func (*Topological) TxIssued

func (ta *Topological) TxIssued(tx snowstorm.Tx) bool

TxIssued implements the Avalanche interface

func (*Topological) VertexIssued

func (ta *Topological) VertexIssued(vtx Vertex) bool

VertexIssued implements the Avalanche interface

func (*Topological) Virtuous

func (ta *Topological) Virtuous() ids.Set

Virtuous implements the Avalanche interface

type TopologicalFactory

type TopologicalFactory struct{}

TopologicalFactory implements Factory by returning a topological struct

func (TopologicalFactory) New

New implements Factory

type Vertex

type Vertex interface {
	choices.Decidable

	// Returns the vertices this vertex depends on
	Parents() []Vertex

	// Returns a series of state transitions to be performed on acceptance
	Txs() []snowstorm.Tx

	Bytes() []byte
}

Vertex is a collection of multiple transactions tied to other vertices

Jump to

Keyboard shortcuts

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