memory

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLogWrites added in v1.0.0

func DisableLogWrites()

func EnableLogWrites added in v1.0.0

func EnableLogWrites()

func NewBatch added in v0.5.1

func NewBatch(get GetFunc, commit CommitFunc) storage.KeyValueTxn

Types

type Batch added in v0.5.1

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

func (*Batch) Begin added in v0.5.1

func (b *Batch) Begin(writable bool) storage.KeyValueTxn

func (*Batch) Commit added in v0.5.1

func (b *Batch) Commit() error

func (*Batch) Copy added in v0.5.1

func (b *Batch) Copy() *Batch

func (*Batch) Discard added in v0.5.1

func (b *Batch) Discard()

func (*Batch) Get added in v0.5.1

func (b *Batch) Get(key storage.Key) (v []byte, err error)

func (*Batch) Put added in v0.5.1

func (b *Batch) Put(key storage.Key, value []byte) error

func (*Batch) PutAll added in v0.5.1

func (b *Batch) PutAll(values map[storage.Key][]byte) error

type CommitFunc added in v0.5.1

type CommitFunc func(map[storage.Key][]byte) error

type DB

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

DB Implements a key value store in memory. Very basic, assumes no initial state for the database That must be handled by the caller, but see the notes on InitDB for future improvements.

func New added in v0.5.1

func New(logger storage.Logger) *DB

func NewDB

func NewDB() *DB

func (*DB) Begin

func (db *DB) Begin(writable bool) storage.KeyValueTxn

func (*DB) Close

func (m *DB) Close() error

Close Nothing really to do but to clear the Entries map

func (*DB) Copy

func (m *DB) Copy() *DB

Copy Make a copy of the database; a useful function for testing

func (*DB) Export

func (m *DB) Export() map[storage.Key][]byte

Export writes the database to a map

func (*DB) Ready

func (m *DB) Ready() bool

Ready Returns true if the database is open and ready to accept reads/writes

type GetFunc added in v0.5.1

type GetFunc func(storage.Key) ([]byte, error)

Jump to

Keyboard shortcuts

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