gkvdb

package
v0.0.0-...-819f294 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

基于DRH(Deep-Re-Hash)算法的高性能Key-Value嵌入式数据库.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinLog

type BinLog struct {
	sync.RWMutex // binlog文件互斥锁
	// contains filtered or unexported fields
}

binlog操作对象

type BinLogItem

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

binlog写入项

type DB

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

KV数据库

func New

func New(path string) (*DB, error)

创建一个KV数据库,path指定数据库文件的存放目录绝对路径

func (*DB) Begin

func (db *DB) Begin(table ...string) *Transaction

创建一个事务

func (*DB) Close

func (db *DB) Close()

关闭数据库链接,释放资源

func (*DB) Get

func (db *DB) Get(key []byte) []byte

查询数据(默认表)

func (*DB) GetFrom

func (db *DB) GetFrom(key []byte, name string) []byte

查询数据(数据表)

func (*DB) Items

func (db *DB) Items(max int) map[string][]byte

获取max条随机键值对,max=-1时获取所有数据返回 该方法会强制性遍历整个数据库

func (*DB) Keys

func (db *DB) Keys(max int) []string

获取最多max个随机键名,构成列表返回

func (*DB) Remove

func (db *DB) Remove(key []byte) error

删除数据(默认表)

func (*DB) RemoveFrom

func (db *DB) RemoveFrom(key []byte, name string) error

删除数据(数据表)

func (*DB) Set

func (db *DB) Set(key []byte, value []byte) error

保存数据(默认表)

func (*DB) SetTo

func (db *DB) SetTo(key []byte, value []byte, name string) error

保存数据(数据表)

func (*DB) Table

func (db *DB) Table(name string) (*Table, error)

获取数据表对象,如果表名已存在,那么返回已存在的表对象

func (*DB) Values

func (db *DB) Values(max int) [][]byte

获取最多max个随机键值,构成列表返回

type MemTable

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

内存表,保存临时的binlog数据

type Table

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

数据表

func (*Table) Close

func (table *Table) Close()

关闭数据库链接,释放资源

func (*Table) Get

func (table *Table) Get(key []byte) []byte

查询数据(数据表)

func (*Table) Items

func (table *Table) Items(max int) map[string][]byte

随机遍历数据表

func (*Table) Keys

func (table *Table) Keys(max int) []string

获取最多max个随机键名,构成列表返回

func (*Table) PrintAllFileSpaces

func (table *Table) PrintAllFileSpaces()

For Test Only

func (*Table) Remove

func (table *Table) Remove(key []byte) error

删除数据(数据表)

func (*Table) Set

func (table *Table) Set(key []byte, value []byte) error

保存数据(数据表)

func (*Table) Values

func (table *Table) Values(max int) [][]byte

获取最多max个随机键值,构成列表返回

type Transaction

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

事务操作对象

func (*Transaction) Commit

func (tx *Transaction) Commit(sync ...bool) error

提交数据

func (*Transaction) Get

func (tx *Transaction) Get(key []byte) []byte

查询数据

func (*Transaction) GetFrom

func (tx *Transaction) GetFrom(key []byte, name string) []byte

查询数据(针对数据表)

func (*Transaction) Remove

func (tx *Transaction) Remove(key []byte) error

删除数据

func (*Transaction) RemoveFrom

func (tx *Transaction) RemoveFrom(key []byte, name string) error

删除数据(针对数据表)

func (*Transaction) Rollback

func (tx *Transaction) Rollback()

回滚数据

func (*Transaction) Set

func (tx *Transaction) Set(key, value []byte) error

添加数据

func (*Transaction) SetTo

func (tx *Transaction) SetTo(key, value []byte, name string) error

添加数据(针对数据表)

Directories

Path Synopsis
B-Tree
B-Tree
文件空间管理
文件空间管理

Jump to

Keyboard shortcuts

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