ancestor

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChooseParents

func ChooseParents(existingParents hash.Events, options hash.Events, strategies []SearchStrategy) hash.Events

ChooseParents returns estimated parents subset, according to provided strategy max is max num of parents to link with (including self-parent) returns set of parents to link, len(res) <= max

Types

type DagIndex

type DagIndex interface {
	dagidx.VectorClock
}

type DiffMetricFn

type DiffMetricFn func(median, current, update idx.Event, validatorIdx idx.Validator) Metric

type Matrix

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

func NewMatrix

func NewMatrix(rows, cols idx.Validator) Matrix

func (Matrix) Clone

func (m Matrix) Clone() Matrix

func (Matrix) Row

func (m Matrix) Row(i idx.Validator) []idx.Event

type Metric

type Metric uint64

type MetricCache

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

func NewMetricFnCache

func NewMetricFnCache(metricFn func(hash.Event) Metric, cacheSize int) *MetricCache

func (*MetricCache) GetMetricOf

func (c *MetricCache) GetMetricOf(id hash.Event) Metric

type MetricStrategy

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

func NewMetricStrategy

func NewMetricStrategy(metricFn func(hash.Event) Metric) *MetricStrategy

func (*MetricStrategy) Choose

func (st *MetricStrategy) Choose(_ hash.Events, options hash.Events) int

Choose chooses the hash from the specified options

type PayloadIndexer

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

func NewPayloadIndexer

func NewPayloadIndexer(cacheSize int) *PayloadIndexer

func (*PayloadIndexer) GetMetricOf

func (h *PayloadIndexer) GetMetricOf(id hash.Event) Metric

func (*PayloadIndexer) ProcessEvent

func (h *PayloadIndexer) ProcessEvent(event dag.Event, payloadMetric Metric)

func (*PayloadIndexer) SearchStrategy

func (h *PayloadIndexer) SearchStrategy() SearchStrategy

type QuorumIndexer

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

func NewQuorumIndexer

func NewQuorumIndexer(validators *pos.Validators, dagi DagIndex, diffMetricFn DiffMetricFn) *QuorumIndexer

func (*QuorumIndexer) GetGlobalMatrix

func (h *QuorumIndexer) GetGlobalMatrix() Matrix

func (*QuorumIndexer) GetGlobalMedianSeqs

func (h *QuorumIndexer) GetGlobalMedianSeqs() []idx.Event

func (*QuorumIndexer) GetMetricOf

func (h *QuorumIndexer) GetMetricOf(id hash.Event) Metric

func (*QuorumIndexer) GetSelfParentSeqs

func (h *QuorumIndexer) GetSelfParentSeqs() []idx.Event

func (*QuorumIndexer) ProcessEvent

func (h *QuorumIndexer) ProcessEvent(event dag.Event, selfEvent bool)

func (*QuorumIndexer) SearchStrategy

func (h *QuorumIndexer) SearchStrategy() SearchStrategy

type RandomStrategy

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

RandomStrategy is used in tests, when vector clock isn't available

func NewRandomStrategy

func NewRandomStrategy(r *rand.Rand) *RandomStrategy

func (*RandomStrategy) Choose

func (st *RandomStrategy) Choose(_ hash.Events, options hash.Events) int

Choose chooses the hash from the specified options

type SearchStrategy

type SearchStrategy interface {
	// Choose chooses the hash from the specified options
	Choose(existingParents hash.Events, options hash.Events) int
}

SearchStrategy defines a criteria used to estimate the "best" subset of parents to emit event with.

Jump to

Keyboard shortcuts

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