db

package
v0.0.0-...-dcefb82 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTransactionConflict = errors.New("transaction conflict")
View Source
var ErrTransactionTooBig = errors.New("transaction too big")

Functions

func End

func End()

func RegisterImplementation

func RegisterImplementation(name string, constructor Constructor)

func Start

func Start()

Types

type Badger

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

func (*Badger) Close

func (b *Badger) Close() error

Close locks the database. Should be called before exiting. This is useful to allow running database processes to finished, but deny locking of new tasks.

func (*Badger) CountPrefix

func (b *Badger) CountPrefix(prefix []byte) int

func (*Badger) End

func (b *Badger) End()

func (*Badger) ForPrefix

func (b *Badger) ForPrefix(prefix []byte, fetchValues bool, fn func([]byte, []byte) (bool, error)) error

func (*Badger) GetBytes

func (b *Badger) GetBytes(key []byte) ([]byte, error)

func (*Badger) HasKey

func (b *Badger) HasKey(key []byte) bool

func (*Badger) Lock

func (b *Badger) Lock()

func (*Badger) NewTransaction

func (b *Badger) NewTransaction(update bool) Transaction

func (*Badger) PutBytes

func (b *Badger) PutBytes(key, value []byte) error

func (*Badger) Remove

func (b *Badger) Remove(key []byte) error

func (*Badger) RemovePrefix

func (b *Badger) RemovePrefix(prefix []byte) error

func (*Badger) Unlock

func (b *Badger) Unlock()

func (*Badger) Update

func (b *Badger) Update(fn func(Transaction) error) error

func (*Badger) View

func (b *Badger) View(fn func(Transaction) error) error

type BadgerTransaction

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

func (*BadgerTransaction) Commit

func (bt *BadgerTransaction) Commit() error

func (*BadgerTransaction) CountPrefix

func (bt *BadgerTransaction) CountPrefix(prefix []byte) int

func (*BadgerTransaction) Discard

func (bt *BadgerTransaction) Discard()

func (*BadgerTransaction) ForPrefix

func (bt *BadgerTransaction) ForPrefix(prefix []byte, fetchValues bool, fn func([]byte, []byte) (bool, error)) error

func (*BadgerTransaction) GetBytes

func (bt *BadgerTransaction) GetBytes(key []byte) ([]byte, error)

func (*BadgerTransaction) HasKey

func (bt *BadgerTransaction) HasKey(key []byte) bool

func (*BadgerTransaction) PutBytes

func (bt *BadgerTransaction) PutBytes(key, value []byte) error

func (*BadgerTransaction) Remove

func (bt *BadgerTransaction) Remove(key []byte) error

func (*BadgerTransaction) RemovePrefix

func (bt *BadgerTransaction) RemovePrefix(prefix []byte) error

type Constructor

type Constructor func() (Interface, error)

type Interface

type Interface interface {
	Manipulator
	Lock()
	Unlock()
	NewTransaction(update bool) Transaction
	Update(func(Transaction) error) error
	View(func(Transaction) error) error
	Close() error
	End()
}
var (
	Singleton Interface
)

type Manipulator

type Manipulator interface {
	GetBytes(key []byte) ([]byte, error)
	PutBytes(key []byte, bytes []byte) error
	HasKey(key []byte) bool
	Remove(key []byte) error
	RemovePrefix(prefix []byte) error
	CountPrefix(prefix []byte) int
	ForPrefix(prefix []byte, fetchValues bool, fn func([]byte, []byte) (bool, error)) error
}

type Transaction

type Transaction interface {
	Manipulator
	Discard()
	Commit() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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