lstore

package
v0.0.0-...-fe13e1c Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ERO = errors.New("ERO")
View Source
var ErrConcurrentUpdate = errors.New("ErrConcurrentUpdate")

Functions

This section is empty.

Types

type BasicReader

type BasicReader interface {
	Get(key []byte, ro *opt.ReadOptions) (value []byte, err error)
	Has(key []byte, ro *opt.ReadOptions) (ret bool, err error)
	NewIterator(slice *util.Range, ro *opt.ReadOptions) iterator.Iterator
}

type BasicWriter

type BasicWriter interface {
	BasicReader
	Put(key, value []byte, wo *opt.WriteOptions) error
	Delete(key []byte, wo *opt.WriteOptions) error
	Write(batch *leveldb.Batch, wo *opt.WriteOptions) error
}

type Database

type Database interface {
	Table(name string) (TableDB, error)
}

type Flags

type Flags uint
const (
	F_NoSnapshot Flags = 1 << iota
	F_IgnoreWrites
	F_DiscardWrites
	F_NoCheck
	F_ReRead
	F_TxIgnoreRead
)
const (
	O_ConcurrentCommit Flags = 1 << iota
	O_UseTransaction
)

These flags are to be choosen depending on the Low Level Database impl.

func (Flags) Has

func (f Flags) Has(o Flags) bool

type ReadIso

type ReadIso uint8
const (
	// Snapshot-Isolation
	READ_SNAPSHOT ReadIso = iota

	// Repeatable-Read
	READ_REPEATABLE

	// Read-Committed or Read-Uncommitted
	READ_ANY
)

type Storage

type Storage struct {
	sync.Mutex
	Basepath string
	// contains filtered or unexported fields
}

func (*Storage) RawTable

func (s *Storage) RawTable(name string) (*leveldb.DB, error)

func (*Storage) Table

func (s *Storage) Table(name string) (TableDB, error)

type TableDB

type TableDB interface {
	BasicWriter
	Snapshot() (TableSnapshot, error)
	Begin() (TableTx, error)
}

type TableSnapshot

type TableSnapshot interface {
	BasicReader
	Release()
}

type TableTx

type TableTx interface {
	BasicWriter
	Commit() error
	Discard()
}

type UDB

type UDB interface {
	UTable(name string) (UTable, error)
	Commit() error
	Discard()
}

User's database.

func Simplistic

func Simplistic(db Database) UDB

type UDBM

type UDBM interface {
	StartTx(r ReadIso, w WriteIso) UDB
}

func Complex

func Complex(db Database, optim Flags) UDBM

type UIterator

type UIterator interface {
	Release()
	Next() bool
	Seek(key []byte) bool
	Key() []byte
	Value() []byte
}

type UTable

type UTable interface {
	Read(key []byte) []byte
	Write(key, value []byte) error
	// An Iterator must only be used until the next call to .Write()
	Iter() UIterator
}

type WriteIso

type WriteIso uint8
const (
	// Transactional Write with commit with conflict-checks.
	WRITE_CHECKED WriteIso = iota

	// Transactional Write with commit.
	WRITE_COMMIT

	// Writes are applied instantly but atomically.
	WRITE_INSTANT_ATOMIC

	// Writes are applied instantly.
	WRITE_INSTANT

	// Read-Only.
	WRITE_DISABLED
)

Jump to

Keyboard shortcuts

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