package radix

import "github.com/influxdata/influxdb/pkg/radix"

Index

Functions

func SortUint64s

func SortUint64s(x []uint64)

SortUint64s sorts a slice of uint64s.

Types

type Tree

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

Tree implements a radix tree. This can be treated as a Dictionary abstract data type. The main advantage over a standard hash map is prefix-based lookups and ordered iteration. The tree is safe for concurrent access.

func New

func New() *Tree

New returns an empty Tree

func NewFromMap

func NewFromMap(m map[string]int) *Tree

NewFromMap returns a new tree containing the keys from an existing map

func (*Tree) DeletePrefix

func (t *Tree) DeletePrefix(s []byte) int

DeletePrefix is used to delete the subtree under a prefix Returns how many nodes were deleted Use this to delete large subtrees efficiently

func (*Tree) Get

func (t *Tree) Get(s []byte) (int, bool)

Get is used to lookup a specific key, returning the value and if it was found

func (*Tree) Insert

func (t *Tree) Insert(s []byte, v int) (int, bool)

Insert is used to add a newentry or update an existing entry. Returns if inserted.

func (*Tree) Len

func (t *Tree) Len() int

Len is used to return the number of elements in the tree

func (*Tree) Maximum

func (t *Tree) Maximum() ([]byte, int, bool)

Maximum is used to return the maximum value in the tree

func (*Tree) Minimum

func (t *Tree) Minimum() ([]byte, int, bool)

Minimum is used to return the minimum value in the tree

Source Files

buffer.go sort.go tree.go

Version
v1.12.0 (latest)
Published
Apr 8, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
2 days ago

Tools for package owners.