dag

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseEvent

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

BaseEvent is the consensus message in the Forest consensus algorithm The structure isn't supposed to be used as-is: Doesn't contain payload, it should be extended by an app Doesn't contain event signature, it should be extended by an app

func (*BaseEvent) Creator

func (e *BaseEvent) Creator() idx.ValidatorID

func (*BaseEvent) Epoch

func (e *BaseEvent) Epoch() idx.Epoch

func (*BaseEvent) Frame

func (e *BaseEvent) Frame() idx.Frame

func (*BaseEvent) ID

func (e *BaseEvent) ID() hash.Event

func (*BaseEvent) IsSelfParent

func (e *BaseEvent) IsSelfParent(hash hash.Event) bool

IsSelfParent is true if specified ID is event's self-parent

func (*BaseEvent) Lamport

func (e *BaseEvent) Lamport() idx.Lamport

func (*BaseEvent) Parents

func (e *BaseEvent) Parents() hash.Events

func (*BaseEvent) SelfParent

func (e *BaseEvent) SelfParent() *hash.Event

SelfParent returns event's self-parent, if any

func (*BaseEvent) Seq

func (e *BaseEvent) Seq() idx.Event

func (*BaseEvent) Size

func (e *BaseEvent) Size() int

func (*BaseEvent) String

func (e *BaseEvent) String() string

String returns string representation.

type Event

type Event interface {
	Epoch() idx.Epoch
	Seq() idx.Event
	Frame() idx.Frame
	Creator() idx.ValidatorID
	Lamport() idx.Lamport

	Parents() hash.Events
	SelfParent() *hash.Event
	IsSelfParent(hash hash.Event) bool

	ID() hash.Event

	String() string

	Size() int
}

type Events

type Events []Event

Events is a ordered slice of events.

func (Events) IDs

func (ee Events) IDs() hash.Events

func (Events) Metric

func (ee Events) Metric() (metric Metric)

func (Events) String

func (ee Events) String() string

String returns human readable representation.

type Metric

type Metric struct {
	Num  idx.Event
	Size uint64
}

func (Metric) String

func (m Metric) String() string

type MutableBaseEvent

type MutableBaseEvent struct {
	BaseEvent
}

func (*MutableBaseEvent) Build

func (me *MutableBaseEvent) Build(rID [24]byte) *BaseEvent

Build build immutable event

func (*MutableBaseEvent) SetCreator

func (e *MutableBaseEvent) SetCreator(v idx.ValidatorID)

func (*MutableBaseEvent) SetEpoch

func (e *MutableBaseEvent) SetEpoch(v idx.Epoch)

func (*MutableBaseEvent) SetFrame

func (e *MutableBaseEvent) SetFrame(v idx.Frame)

func (*MutableBaseEvent) SetID

func (e *MutableBaseEvent) SetID(rID [24]byte)

func (*MutableBaseEvent) SetLamport

func (e *MutableBaseEvent) SetLamport(v idx.Lamport)

func (*MutableBaseEvent) SetParents

func (e *MutableBaseEvent) SetParents(v hash.Events)

func (*MutableBaseEvent) SetSeq

func (e *MutableBaseEvent) SetSeq(v idx.Event)

type MutableEvent

type MutableEvent interface {
	Event
	SetEpoch(idx.Epoch)
	SetSeq(idx.Event)
	SetFrame(idx.Frame)
	SetCreator(idx.ValidatorID)
	SetLamport(idx.Lamport)

	SetParents(hash.Events)

	SetID(id [24]byte)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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