vecmt

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreationTimer

type CreationTimer interface {
	CreationTime() inter.Timestamp
}

type HighestBefore

type HighestBefore struct {
	VSeq  *vecfc.HighestBeforeSeq
	VTime *HighestBeforeTime
}

func NewHighestBefore

func NewHighestBefore(size idx.Validator) *HighestBefore

NewHighestBefore creates new HighestBefore vector.

func (*HighestBefore) CollectFrom

func (self *HighestBefore) CollectFrom(_other vecengine.HighestBeforeI, num idx.Validator)

func (*HighestBefore) GatherFrom

func (self *HighestBefore) GatherFrom(to idx.Validator, _other vecengine.HighestBeforeI, from []idx.Validator)

func (*HighestBefore) InitWithEvent

func (b *HighestBefore) InitWithEvent(i idx.Validator, e dag.Event)

func (*HighestBefore) IsEmpty

func (b *HighestBefore) IsEmpty(i idx.Validator) bool

func (*HighestBefore) IsForkDetected

func (b *HighestBefore) IsForkDetected(i idx.Validator) bool

func (*HighestBefore) MinSeq

func (b *HighestBefore) MinSeq(i idx.Validator) idx.Event

func (*HighestBefore) Seq

func (b *HighestBefore) Seq(i idx.Validator) idx.Event

func (*HighestBefore) SetForkDetected

func (b *HighestBefore) SetForkDetected(i idx.Validator)

type HighestBeforeTime

type HighestBeforeTime []byte

HighestBeforeTime is a vector of highest events (their CreationTime) which are observed by source event

func NewHighestBeforeTime

func NewHighestBeforeTime(size idx.Validator) *HighestBeforeTime

NewHighestBeforeTime creates new HighestBeforeTime vector.

func (HighestBeforeTime) Get

Get i's position in the byte-encoded vector clock

func (*HighestBeforeTime) Set

func (b *HighestBeforeTime) Set(i idx.Validator, time inter.Timestamp)

Set i's position in the byte-encoded vector clock

func (HighestBeforeTime) Size

func (b HighestBeforeTime) Size() idx.Validator

Size of the vector clock

type Index

type Index struct {
	*vecfc.Index
	Base *vecfc.Index
	// contains filtered or unexported fields
}

Index is a data to detect forkless-cause condition, calculate median timestamp, detect forks.

func NewIndex

func NewIndex(crit func(error), config IndexConfig) *Index

NewIndex creates Index instance.

func NewIndexWithBase

func NewIndexWithBase(crit func(error), config IndexConfig, base *vecfc.Index) *Index

func (*Index) GetEngineCallbacks

func (vi *Index) GetEngineCallbacks() vecengine.Callbacks

func (*Index) GetHighestBefore

func (vi *Index) GetHighestBefore(id hash.Event) *HighestBefore

GetHighestBefore reads the vector from DB

func (*Index) GetHighestBeforeTime

func (vi *Index) GetHighestBeforeTime(id hash.Event) *HighestBeforeTime

GetHighestBeforeTime reads the vector from DB

func (*Index) GetMergedHighestBefore

func (vi *Index) GetMergedHighestBefore(id hash.Event) *HighestBefore

GetMergedHighestBefore returns HighestBefore vector clock without branches, where branches are merged into one

func (*Index) MedianTime

func (vi *Index) MedianTime(id hash.Event, defaultTime inter.Timestamp) inter.Timestamp

MedianTime calculates weighted median of claimed time within highest observed events.

func (*Index) NoCheaters

func (vi *Index) NoCheaters(selfParent *hash.Event, options hash.Events) hash.Events

NoCheaters excludes events which are observed by selfParents as cheaters. Called by emitter to exclude cheater's events from potential parents list.

func (*Index) Reset

func (vi *Index) Reset(validators *pos.Validators, db kvdb.Store, getEvent func(hash.Event) dag.Event)

Reset resets buffers.

func (*Index) SetHighestBefore

func (vi *Index) SetHighestBefore(id hash.Event, vec *HighestBefore)

SetHighestBefore stores the vectors into DB

func (*Index) SetHighestBeforeTime

func (vi *Index) SetHighestBeforeTime(id hash.Event, vec *HighestBeforeTime)

SetHighestBeforeTime stores the vector into DB

type IndexCacheConfig

type IndexCacheConfig struct {
	HighestBeforeTimeSize uint
}

IndexCacheConfig - config for cache sizes of Engine

type IndexConfig

type IndexConfig struct {
	Fc     vecfc.IndexConfig
	Caches IndexCacheConfig
}

IndexConfig - Engine config (cache sizes)

func DefaultConfig

func DefaultConfig(scale cachescale.Func) IndexConfig

DefaultConfig returns default index config

func LiteConfig

func LiteConfig() IndexConfig

LiteConfig returns default index config for tests

Jump to

Keyboard shortcuts

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