treesvc

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalTree

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

func New

func New(tree jet.PrefixTree, pn pulse.Number) *LocalTree

func NewEmpty

func NewEmpty() *LocalTree

func NewPerfect

func NewPerfect(depth uint8, pn pulse.Number) *LocalTree

func (*LocalTree) FinishGenesis

func (p *LocalTree) FinishGenesis(depth uint8, lastGenesisPulse pulse.Number)

func (*LocalTree) GenesisPulse

func (p *LocalTree) GenesisPulse() pulse.Number

func (*LocalTree) GetTrees

func (p *LocalTree) GetTrees(pn pulse.Number) (prev, cur jet.PrefixTree, ok bool)

func (*LocalTree) Init

func (p *LocalTree) Init(managed.Holder)

func (*LocalTree) IsGenesisFinished

func (p *LocalTree) IsGenesisFinished() bool

func (*LocalTree) PulseMigration

func (p *LocalTree) PulseMigration(_ managed.Holder, pr pulse.Range)

func (*LocalTree) SplitNext

func (p *LocalTree) SplitNext(id jet.DropID)

func (*LocalTree) Start

func (p *LocalTree) Start(managed.Holder)

func (*LocalTree) Stop

func (p *LocalTree) Stop(managed.Holder)

func (*LocalTree) TryLockGenesis

func (p *LocalTree) TryLockGenesis(pn pulse.Number) bool

type Service

type Service interface {
	// GetTrees provides previous and current jet trees. For genesis-state both trees will be empty.
	// Pulse number is required to enforce synchronicity between the service and the caller.
	// When current pulse number is mismatched, then (found)==false and trees are empty.
	GetTrees(pulse.Number) (prev, cur jet.PrefixTree, found bool)

	// FinishGenesis must be called after genesis procedure is finished with (depth) is a depth of
	// jet tree to be used for normal operations (like multi-split) and (lastGenesisPulse) is the pulse
	// when genesis was yet active.
	FinishGenesis(depth uint8, lastGenesisPulse pulse.Number)

	// IsGenesisFinished returns true after FinishGenesis is called even without a pulse change.
	IsGenesisFinished() bool

	// TryLockGenesis marks genesis as started. This prevents multiple genesis initializations in different pulses.
	TryLockGenesis(pulse.Number) bool

	// GenesisPulse returns pulse set by either TryLockGenesis or by FinishGenesis
	GenesisPulse() pulse.Number

	// SplitNext registers a split operation to be applied at next pulse.
	// Only one split or merge operation can be applied to a jet per pulse.
	SplitNext(jet.DropID)
}

Jump to

Keyboard shortcuts

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