kv

package
v0.0.0-...-e4e12f0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket string

Bucket provides logical bucket for kv store.

func (Bucket) NewGetter

func (b Bucket) NewGetter(src Getter) Getter

NewGetter creates a bucket getter from the source getter.

func (Bucket) NewPutter

func (b Bucket) NewPutter(src Putter) Putter

NewPutter creates a bucket putter from the source putter.

func (Bucket) NewStore

func (b Bucket) NewStore(src Store) Store

NewStore creates a bucket store from the source store.

type Bulk

type Bulk interface {
	Putter
	EnableAutoFlush() // if set, the bulk will be non-atomic
	Write() error
}

Bulk is the bulk putter.

type BulkFunc

type BulkFunc func() Bulk

func (BulkFunc) Bulk

func (f BulkFunc) Bulk() Bulk

type DeleteFunc

type DeleteFunc func(key []byte) error

func (DeleteFunc) Delete

func (f DeleteFunc) Delete(key []byte) error

type EnableAutoFlushFunc

type EnableAutoFlushFunc func()

func (EnableAutoFlushFunc) EnableAutoFlush

func (f EnableAutoFlushFunc) EnableAutoFlush()

type ErrorFunc

type ErrorFunc func() error

func (ErrorFunc) Error

func (f ErrorFunc) Error() error

type FirstFunc

type FirstFunc func() bool

func (FirstFunc) First

func (f FirstFunc) First() bool

type GetFunc

type GetFunc func(key []byte) ([]byte, error)

func (GetFunc) Get

func (f GetFunc) Get(key []byte) ([]byte, error)

type Getter

type Getter interface {
	Get(key []byte) ([]byte, error)
	Has(key []byte) (bool, error)
	IsNotFound(err error) bool
}

Getter defines methods to read kv.

type HasFunc

type HasFunc func(key []byte) (bool, error)

func (HasFunc) Has

func (f HasFunc) Has(key []byte) (bool, error)

type IsNotFoundFunc

type IsNotFoundFunc func(err error) bool

func (IsNotFoundFunc) IsNotFound

func (f IsNotFoundFunc) IsNotFound(err error) bool

type IterateFunc

type IterateFunc func(r Range) Iterator

func (IterateFunc) Iterate

func (f IterateFunc) Iterate(r Range) Iterator

type Iterator

type Iterator interface {
	First() bool
	Last() bool
	Next() bool
	Prev() bool
	Key() []byte
	Value() []byte
	Release()
	Error() error
}

Iterator iterates over kv pairs.

type KeyFunc

type KeyFunc func() []byte

func (KeyFunc) Key

func (f KeyFunc) Key() []byte

type LastFunc

type LastFunc func() bool

func (LastFunc) Last

func (f LastFunc) Last() bool

type NextFunc

type NextFunc func() bool

func (NextFunc) Next

func (f NextFunc) Next() bool

type PrevFunc

type PrevFunc func() bool

func (PrevFunc) Prev

func (f PrevFunc) Prev() bool

type PutFunc

type PutFunc func(key, val []byte) error

func (PutFunc) Put

func (f PutFunc) Put(key, val []byte) error

type Putter

type Putter interface {
	Put(key, val []byte) error
	Delete(key []byte) error
}

Putter defines methods to write kv.

type Range

type Range struct {
	Start []byte // start of key range (included)
	Limit []byte // limit of key range (excluded)
}

Range is the key range.

type ReleaseFunc

type ReleaseFunc func()

func (ReleaseFunc) Release

func (f ReleaseFunc) Release()

type Snapshot

type Snapshot interface {
	Getter
	Release()
}

Snapshot is the store's snapshot.

type SnapshotFunc

type SnapshotFunc func() Snapshot

func (SnapshotFunc) Snapshot

func (f SnapshotFunc) Snapshot() Snapshot

type Store

type Store interface {
	Getter
	Putter

	Snapshot() Snapshot
	Bulk() Bulk
	Iterate(r Range) Iterator
}

Store defines the full functional kv store.

type ValueFunc

type ValueFunc func() []byte

func (ValueFunc) Value

func (f ValueFunc) Value() []byte

type WriteFunc

type WriteFunc func() error

func (WriteFunc) Write

func (f WriteFunc) Write() error

Jump to

Keyboard shortcuts

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