btree

package
v0.0.0-...-a8f546d Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package btree provide a disk-based btree

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB ...

func Create

func Create(name string) (*DB, error)

Create creates a database

func Open

func Open(name string) (*DB, error)

Open opens an existed btree file

func (*DB) Close

func (d *DB) Close() error

Close closes the database

func (*DB) Delete

func (d *DB) Delete(hash *byte) error

Delete remove item with the given key 'hash' from the database file.

func (*DB) Foreach

func (d *DB) Foreach(iter func(key [16]byte, value []byte))

Foreach iterates over all items in the database file.

func (*DB) Get

func (d *DB) Get(hash *byte) []byte

Get look up item with the given key 'hash' in the database file. Length of the item is stored in 'len'. Returns a pointer to the contents of the item. The returned pointer should be released with free() after use.

func (*DB) Insert

func (d *DB) Insert(chash *byte, data []byte)

Insert a new item with key 'hash' with the contents in 'data' to the database file.

Jump to

Keyboard shortcuts

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