memdb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSize = 1 << 10

DefaultSize is the default initial size of the memory database

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database is an ephemeral key-value store that implements the Database interface.

func New

func New() *Database

New returns a map with the Database interface methods implemented.

func NewWithSize

func NewWithSize(size int) *Database

NewWithSize returns a map pre-allocated to the provided size with the Database interface methods implemented.

func (*Database) Close

func (db *Database) Close() error

Close implements the Database interface

func (*Database) Compact

func (db *Database) Compact(start []byte, limit []byte) error

Compact implements the Database interface

func (*Database) Delete

func (db *Database) Delete(key []byte) error

Delete implements the Database interface

func (*Database) Get

func (db *Database) Get(key []byte) ([]byte, error)

Get implements the Database interface

func (*Database) Has

func (db *Database) Has(key []byte) (bool, error)

Has implements the Database interface

func (*Database) NewBatch

func (db *Database) NewBatch() database.Batch

NewBatch implements the Database interface

func (*Database) NewIterator

func (db *Database) NewIterator() database.Iterator

NewIterator implements the Database interface

func (*Database) NewIteratorWithPrefix

func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator

NewIteratorWithPrefix implements the Database interface

func (*Database) NewIteratorWithStart

func (db *Database) NewIteratorWithStart(start []byte) database.Iterator

NewIteratorWithStart implements the Database interface

func (*Database) NewIteratorWithStartAndPrefix

func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

NewIteratorWithStartAndPrefix implements the Database interface

func (*Database) Put

func (db *Database) Put(key []byte, value []byte) error

Put implements the Database interface

func (*Database) Stat

func (db *Database) Stat(property string) (string, error)

Stat implements the Database interface

Jump to

Keyboard shortcuts

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