badgerd

package
v0.0.0-...-cd557cf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPath = "./data"
)
View Source
var ErrNotLeader = errors.New("current node is not leader")

Functions

This section is empty.

Types

type DB

type DB interface {
	View(fn func(tx *badger.Txn) error) error
	Subscribe(ctx context.Context, cb func(kv *badger.KVList) error, matches []pb.Match) error
	NewTransaction(ctx context.Context, update bool) (Tx, error)
	Replicated() bool
	IsLeader() bool
	Leader() string
	LeaderChanges() <-chan string
	LeaderConn() (grpc.ClientConnInterface, bool)
	LinearizableReads() bool
	Close() error
}

func Open

func Open(ctx context.Context, opts ...Option) (DB, error)

type Item

type Item = pending.Item

type Iterator

type Iterator = pending.Iterator

type Logger

type Logger interface {
	Errorf(string, ...interface{})
	Warningf(string, ...interface{})
	Infof(string, ...interface{})
	Debugf(string, ...interface{})
	Tracef(string, ...interface{})
}

type Option

type Option func(o *options)

func WithBadgerOptionsFunc

func WithBadgerOptionsFunc(fn func(opts badger.Options) badger.Options) Option

func WithInMemory

func WithInMemory(b bool) Option

func WithLogger

func WithLogger(l Logger) Option

func WithPath

func WithPath(path string) Option

func WithReplication

func WithReplication(opts ...replication.Option) Option

type Tx

type Tx interface {
	ReadTs() uint64
	Iterator(opt badger.IteratorOptions) Iterator
	Set(ctx context.Context, key, value []byte, expiresAt uint64) error
	Get(ctx context.Context, key []byte) (Item, error)
	Delete(ctx context.Context, key []byte) error
	Commit(ctx context.Context) error
	Close(ctx context.Context) error
}

Directories

Path Synopsis
dns

Jump to

Keyboard shortcuts

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