bptree

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValTypeZero = *new([]byte)

Functions

func Btoi

func Btoi(b []byte) int64

func Compare

func Compare(a, b string) int

func Equal

func Equal(a, b string) bool

func IntToKey

func IntToKey(key int64) string

func IntToVal

func IntToVal(val int64) []byte

func Itob

func Itob(i int64) []byte

func KeyToInt

func KeyToInt(key string) int64

func ValToInt

func ValToInt(val []byte) int64

Types

type BPTree

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

BPTree represents the root of a b+tree

func NewBPTree

func NewBPTree() *BPTree

NewBPTree creates and returns a new tree

func (*BPTree) Add

func (t *BPTree) Add(key string, value []byte)

Add inserts a new record using the provided key. It only inserts an entry if the key does not already exist.

func (*BPTree) AddInt

func (t *BPTree) AddInt(key int64, value int64)

AddInt inserts a new record using the provided integer key and value. It only inserts an entry if the key does not already exist.

func (*BPTree) Close

func (t *BPTree) Close()

func (*BPTree) Del

func (t *BPTree) Del(key string) (string, []byte)

func (*BPTree) DelInt

func (t *BPTree) DelInt(key int64) (int64, int64)

func (*BPTree) Get

func (t *BPTree) Get(key string) (string, []byte)

Get returns the record for a given key if it exists

func (*BPTree) GetClosest

func (t *BPTree) GetClosest(key string) (string, []byte)

func (*BPTree) GetInt

func (t *BPTree) GetInt(key int64) (int64, int64)

GetInt returns the record for a given key if it exists

func (*BPTree) Has

func (t *BPTree) Has(key string) bool

Has returns a boolean indicating weather or not the provided key and associated record exists.

func (*BPTree) HasInt

func (t *BPTree) HasInt(key int64) bool

HasInt tests and returns a boolean value if the provided key exists in the tree

func (*BPTree) Len

func (t *BPTree) Len() int

func (*BPTree) Max

func (t *BPTree) Max() (string, []byte)

func (*BPTree) Min

func (t *BPTree) Min() (string, []byte)

func (*BPTree) Put

func (t *BPTree) Put(key string, value []byte) bool

Put is mainly used when you wish to upsert as it assumes the data to already be contained the tree. It will overwrite duplicate keys, as it does not check to see if the key exists

func (*BPTree) PutInt

func (t *BPTree) PutInt(key int64, value int64) bool

PutInt is mainly used when you wish to upsert as it assumes the data to already be contained the tree. It will overwrite duplicate keys, as it does not check to see if the key exists

func (*BPTree) Range

func (t *BPTree) Range(iter func(k string, v []byte) bool)

func (*BPTree) Size

func (t *BPTree) Size() int64

Jump to

Keyboard shortcuts

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