rangetree

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebrisFactory

type DebrisFactory func(startKey, EndKey []byte, item RangeItem) []RangeItem

DebrisFactory is the factory that generates some debris when updating items.

type RangeItem

type RangeItem interface {
	Less(RangeItem) bool
	GetStartKey() []byte
	GetEndKey() []byte
}

RangeItem is the item of the range tree.

type RangeTree

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

RangeTree is the tree contains RangeItems.

func NewRangeTree

func NewRangeTree(degree int, factory DebrisFactory) *RangeTree

NewRangeTree is the constructor of the range tree.

func (*RangeTree) Find

func (r *RangeTree) Find(item RangeItem) RangeItem

Find returns the range item contains the start key.

func (*RangeTree) GetAdjacentItem

func (r *RangeTree) GetAdjacentItem(item RangeItem) (prev RangeItem, next RangeItem)

GetAdjacentItem returns the adjacent range item.

func (*RangeTree) GetAt

func (r *RangeTree) GetAt(index int) RangeItem

GetAt returns the given index item.

func (*RangeTree) GetOverlaps

func (r *RangeTree) GetOverlaps(item RangeItem) []RangeItem

GetOverlaps returns the range items that has some intersections with the given items.

func (*RangeTree) GetWithIndex

func (r *RangeTree) GetWithIndex(item RangeItem) (RangeItem, int)

GetWithIndex returns index and item for the given item.

func (*RangeTree) Len

func (r *RangeTree) Len() int

Len returns the count of the range tree.

func (*RangeTree) Remove

func (r *RangeTree) Remove(item RangeItem) RangeItem

Remove removes the given item and return the deleted item.

func (*RangeTree) ScanRange

func (r *RangeTree) ScanRange(start RangeItem, f func(_ RangeItem) bool)

ScanRange scan the start item util the result of the function is false.

func (*RangeTree) Update

func (r *RangeTree) Update(item RangeItem) []RangeItem

Update insert the item and delete overlaps.

Jump to

Keyboard shortcuts

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