Documentation ¶
Index ¶
- type CreationTimer
- type HighestBefore
- func (self *HighestBefore) CollectFrom(_other vecengine.HighestBeforeI, num idx.Validator)
- func (self *HighestBefore) GatherFrom(to idx.Validator, _other vecengine.HighestBeforeI, from []idx.Validator)
- func (b *HighestBefore) InitWithEvent(i idx.Validator, e dag.Event)
- func (b *HighestBefore) IsEmpty(i idx.Validator) bool
- func (b *HighestBefore) IsForkDetected(i idx.Validator) bool
- func (b *HighestBefore) MinSeq(i idx.Validator) idx.Event
- func (b *HighestBefore) Seq(i idx.Validator) idx.Event
- func (b *HighestBefore) SetForkDetected(i idx.Validator)
- type HighestBeforeTime
- type Index
- func (vi *Index) GetEngineCallbacks() vecengine.Callbacks
- func (vi *Index) GetHighestBefore(id hash.Event) *HighestBefore
- func (vi *Index) GetHighestBeforeTime(id hash.Event) *HighestBeforeTime
- func (vi *Index) GetMergedHighestBefore(id hash.Event) *HighestBefore
- func (vi *Index) MedianTime(id hash.Event, defaultTime inter.Timestamp) inter.Timestamp
- func (vi *Index) NoCheaters(selfParent *hash.Event, options hash.Events) hash.Events
- func (vi *Index) Reset(validators *pos.Validators, db kvdb.Store, getEvent func(hash.Event) dag.Event)
- func (vi *Index) SetHighestBefore(id hash.Event, vec *HighestBefore)
- func (vi *Index) SetHighestBeforeTime(id hash.Event, vec *HighestBeforeTime)
- type IndexCacheConfig
- type IndexConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreationTimer ¶
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) IsForkDetected ¶
func (b *HighestBefore) IsForkDetected(i idx.Validator) bool
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 ¶
func (b HighestBeforeTime) Get(i idx.Validator) inter.Timestamp
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 ¶
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 (*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 ¶
MedianTime calculates weighted median of claimed time within highest observed events.
func (*Index) NoCheaters ¶
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