lachesis

package
v0.0.0-...-e884aa9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyEventFn

type ApplyEventFn func(event dag.Event)

type BeginBlockFn

type BeginBlockFn func(block *Block) BlockCallbacks

type Block

type Block struct {
	Atropos  hash.Event
	Cheaters Cheaters
}

Block is a part of an ordered chain of batches of events.

type BlockCallbacks

type BlockCallbacks struct {
	// ApplyEvent is called on confirmation of each event during block processing.
	// Cannot be called twice for the same event.
	// The order in which ApplyBlock is called for events is deterministic but undefined. It's application's responsibility to sort events according to its needs.
	// It's application's responsibility to interpret this data (e.g. events may be related to batches of transactions or other ordered data).
	ApplyEvent ApplyEventFn
	// EndBlock indicates that ApplyEvent was called for all the events
	// Returns validators group for a new epoch, if epoch must be sealed after this bock
	// If epoch must not get sealed, then this callback must return nil
	EndBlock EndBlockFn
}

type Cheaters

type Cheaters []idx.ValidatorID

Cheaters is a slice type for storing cheaters list.

func (Cheaters) GetRlp

func (s Cheaters) GetRlp(i int) []byte

getRlp implements Rlpable and returns the i'th element of s in rlp.

func (Cheaters) Len

func (s Cheaters) Len() int

Len returns the length of s.

func (Cheaters) Set

func (s Cheaters) Set() map[idx.ValidatorID]struct{}

Set returns map of cheaters

func (Cheaters) Swap

func (s Cheaters) Swap(i, j int)

Swap swaps the i'th and the j'th element in s.

type Consensus

type Consensus interface {
	// Process takes event for processing.
	Process(e dag.Event) error
	// Build sets consensus fields. Returns an error if event should be dropped.
	Build(e dag.MutableEvent) error
	// Reset switches epoch state to a new empty epoch.
	Reset(epoch idx.Epoch, validators *pos.Validators) error
}

Consensus is a consensus interface.

type ConsensusCallbacks

type ConsensusCallbacks struct {
	// BeginBlock returns further callbacks for processing of this block
	BeginBlock BeginBlockFn
}

ConsensusCallbacks contains callbacks called during block processing by consensus engine

type EndBlockFn

type EndBlockFn func() (sealEpoch *pos.Validators)

Jump to

Keyboard shortcuts

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