btree

package
v0.0.0-...-a414206 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BNODE_NODE = 1 //internal nodes without values
	BNODE_LEAF = 2 //leaf nodes with values
)
View Source
const (
	MODE_UPSERT      = 0 //insert or replace
	MODE_UPDATE_ONLY = 1 // update existing keys
	MODE_INSERT_ONLY = 2 //add only new keys
)
View Source
const BTREE_MAX_KEY_SIZE = 1000
View Source
const BTREE_MAX_VAL_SIZE = 3000
View Source
const BTREE_PAGE_SIZE = 4096
View Source
const HEADER = 4

Variables

This section is empty.

Functions

This section is empty.

Types

type BNode

type BNode []byte

in memory data type

type BTree

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

func (*BTree) Delete

func (tree *BTree) Delete(req *DeleteReq) (bool, error)

func (*BTree) Get

func (tree *BTree) Get(key []byte) ([]byte, bool)

func (*BTree) Update

func (tree *BTree) Update(req *UpdateReq) (bool, error)

func (*BTree) Upsert

func (tree *BTree) Upsert(key []byte, val []byte) (bool, error)

type DeleteReq

type DeleteReq struct {
	Key []byte
	Old []byte
	// contains filtered or unexported fields
}

type UpdateReq

type UpdateReq struct {
	Added   bool // new key
	Updated bool
	Old     []byte //value before update
	Key     []byte
	Val     []byte
	Mode    int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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