jetalloc

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SplitMedian = 7 // makes 0 vs 1 ratio like [0..6] vs [7..15]

Variables

This section is empty.

Functions

This section is empty.

Types

type HashFactoryFunc

type HashFactoryFunc = func() hash.Hash

type MaterialAllocationCalculator

type MaterialAllocationCalculator interface {
	AllocationOfLine(local reference.Local) jet.Prefix

	// AllocationOfJets MUST receive list of all jets, otherwise allocation may be incorrect.
	// This requirements for all jets is intended to support balanced distribution algorithms.
	AllocationOfJets([]jet.ExactID, pulse.Number) map[jet.ID]node.ShortNodeID
}

type MaterialAllocationStrategy

type MaterialAllocationStrategy interface {
	CreateCalculator(entropy longbits.FixedReader, population census.OnlinePopulation) MaterialAllocationCalculator
}

func NewMaterialAllocationStrategy

func NewMaterialAllocationStrategy(usePower bool) MaterialAllocationStrategy

type PrefixCalc

type PrefixCalc struct {
	OverlapOfs  uint8
	SplitMedian uint8
}

Converts a byte sequence into a bit prefix for PrefixTree.

Must set OverlapOfs>0 when a structured header is present within a byte sequence. When OverlapOfs !=0, then the calculator will mix b[n]^b[n + OverlapOfs]

func NewPrefixCalc

func NewPrefixCalc() PrefixCalc

Default prefix calculator, requires 12 bytes for 16 bit prefix and uses SplitMedian const for mis-balancing.

Recommended use:

		bitPrefix := NewPrefixCalc().FromXXX(prefixTree.MaxDepth(), reference)
       or
		bitPrefix := NewPrefixCalc().FromXXX(16, reference)
		...
		bitPrefix, bitPrefixLen = prefixTree.GetPrefix(bitPrefix)

func (PrefixCalc) FromReader

func (p PrefixCalc) FromReader(prefixLen int, data io.Reader) (jet.Prefix, error)

Converts data[:OverlapOfs + (prefixLen)/2] into prefixLen bits.

func (PrefixCalc) FromSlice

func (p PrefixCalc) FromSlice(prefixLen int, data []byte) jet.Prefix

Converts data[:OverlapOfs + (prefixLen)/2] into prefixLen bits.

Jump to

Keyboard shortcuts

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