byodb07

package
v0.0.0-...-9315a8a Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 8 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 BTREE_MAX_KEY_SIZE = 1000
View Source
const BTREE_MAX_VAL_SIZE = 3000
View Source
const BTREE_PAGE_SIZE = 4096
View Source
const DB_SIG = "BuildYourOwnDB07"
View Source
const FREE_LIST_CAP = (BTREE_PAGE_SIZE - FREE_LIST_HEADER) / 8
View Source
const FREE_LIST_HEADER = 8
View Source
const HEADER = 4

Variables

This section is empty.

Functions

This section is empty.

Types

type BNode

type BNode []byte // can be dumped to the disk

type BTree

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

func (*BTree) Delete

func (tree *BTree) Delete(key []byte) bool

func (*BTree) Get

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

func (*BTree) Insert

func (tree *BTree) Insert(key []byte, val []byte)

the interface

type FreeList

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

func (*FreeList) PopHead

func (fl *FreeList) PopHead() uint64

get 1 item from the list head. return 0 on failure.

func (*FreeList) PushTail

func (fl *FreeList) PushTail(ptr uint64)

add 1 item to the tail

func (*FreeList) SetMaxSeq

func (fl *FreeList) SetMaxSeq()

make the newly added items available for consumption

type KV

type KV struct {
	Path  string
	Fsync func(int) error // overridable; for testing
	// contains filtered or unexported fields
}

func (*KV) Close

func (db *KV) Close()

cleanups

func (*KV) Del

func (db *KV) Del(key []byte) (bool, error)

func (*KV) Get

func (db *KV) Get(key []byte) ([]byte, bool)

KV interfaces

func (*KV) Open

func (db *KV) Open() error

open or create a DB file

func (*KV) Set

func (db *KV) Set(key []byte, val []byte) error

type LNode

type LNode []byte

node format: | next | pointers | unused | | 8B | n*8B | ... |

Jump to

Keyboard shortcuts

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