badgerkv

package
v0.0.0-...-ba08d48 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Unlicense Imports: 4 Imported by: 0

Documentation

Overview

Package badgerkv provides an adapter to Badger's key-value store that is compatible with libkv's Store interface.

Index

Constants

View Source
const (
	MaxValueLogFileSize      = 256 << 20
	MaxDeleteTransactionSize = 65536

	MaxListedKeys = 16
)

Variables

View Source
var (
	ErrKeyNotFound = store.ErrKeyNotFound
	ErrKeyExists   = store.ErrKeyExists
	ErrKeyModified = store.ErrKeyModified
)

Functions

This section is empty.

Types

type Lister

type Lister interface {
	// Returns a list of consecutive keys beginning with |start|. The number of
	// keys returned is undefined, but will be at least 1, unless there are no
	// keys, in which case the nil list will be returned.
	ListKeys(start string) ([]string, error)
}

type Store

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

func NewStore

func NewStore(name string) (*Store, error)

func (*Store) AtomicDelete

func (t *Store) AtomicDelete(key string, previous *store.KVPair) (bool, error)

func (*Store) AtomicPut

func (t *Store) AtomicPut(key string, value []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error)

func (*Store) Close

func (t *Store) Close()

func (*Store) DB

func (t *Store) DB() *badger.DB

func (*Store) Delete

func (t *Store) Delete(key string) error

func (*Store) DeleteRange

func (t *Store) DeleteRange(start, end string) error

DeleteRange deletes the range of keys [start, end). The range is open and the end key is not deleted. Returns nil if all keys in the range are deleted. There are no guarantees which keys have been deleted on error.

func (*Store) DeleteTree

func (*Store) DeleteTree(directory string) error

func (*Store) Exists

func (t *Store) Exists(key string) (bool, error)

func (*Store) Get

func (t *Store) Get(key string) (*store.KVPair, error)

func (*Store) GetInto

func (t *Store) GetInto(key string, buf []byte) (*store.KVPair, error)

func (*Store) List

func (*Store) List(directory string) ([]*store.KVPair, error)

func (*Store) ListKeys

func (t *Store) ListKeys(start string) ([]string, error)

func (*Store) NewLock

func (*Store) NewLock(key string, options *store.LockOptions) (store.Locker, error)

func (*Store) Put

func (t *Store) Put(key string, value []byte, options *store.WriteOptions) error

func (*Store) Watch

func (*Store) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error)

func (*Store) WatchTree

func (*Store) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error)

Jump to

Keyboard shortcuts

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