badger

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBadgerGCOptions = BadgerGCOptions{
	GCDiscardRatio: 0.5,
	GCInterval:     time.Minute * 5,
	GCSleep:        time.Second * 15,
}

Functions

func BadgerGC

func BadgerGC(ctx context.Context, extendedOptions *BadgerGCOptions, db *badger.DB)

func DefaultOptions

func DefaultOptions(ctx context.Context, filePath string) badger.Options

func LowMemLowCPUBadgerOptions

func LowMemLowCPUBadgerOptions(ctx context.Context, filePath string) badger.Options

func LowMemOptions

func LowMemOptions(ctx context.Context, filePath string) badger.Options

Types

type BadgerGCOptions

type BadgerGCOptions struct {
	GCDiscardRatio float64
	GCInterval     time.Duration
	GCSleep        time.Duration
}

type BadgerLogger

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

func NewBadgerLogger

func NewBadgerLogger(ctx context.Context, callerSkip int) *BadgerLogger

func (*BadgerLogger) Debugf

func (l *BadgerLogger) Debugf(format string, v ...interface{})

func (*BadgerLogger) Errorf

func (l *BadgerLogger) Errorf(format string, v ...interface{})

func (*BadgerLogger) Infof

func (l *BadgerLogger) Infof(format string, v ...interface{})

func (*BadgerLogger) Warningf

func (l *BadgerLogger) Warningf(format string, v ...interface{})

type DB

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

func New

func New(ctx context.Context, options badger.Options, dbOptions ...Option) (*DB, error)

func (*DB) Close

func (t *DB) Close(ctx context.Context) error

func (*DB) Commit

func (t *DB) Commit(ctx context.Context, txn *badger.Txn) error

func (*DB) DB added in v1.1.6

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

func (*DB) Delete added in v1.0.4

func (t *DB) Delete(ctx context.Context, key []byte) error

func (*DB) GC

func (t *DB) GC(ctx context.Context, options *BadgerGCOptions) error

func (*DB) Get

func (t *DB) Get(ctx context.Context, txn *badger.Txn, key []byte) (value []byte, err error)

func (*DB) MetricEnabled added in v1.2.5

func (t *DB) MetricEnabled() bool

func (*DB) NewTransaction added in v1.0.2

func (t *DB) NewTransaction(update bool) *badger.Txn

func (*DB) TracingEnabled added in v1.2.5

func (t *DB) TracingEnabled() bool

func (*DB) Update

func (t *DB) Update(ctx context.Context, entry *badger.Entry) error

func (*DB) View

func (t *DB) View(ctx context.Context, key []byte, callback func([]byte) error) error

type Option added in v1.2.5

type Option = func(opt *option)

func WithMetric added in v1.2.5

func WithMetric(enabled bool) Option

func WithTracing added in v1.2.5

func WithTracing(enabled bool) Option

Jump to

Keyboard shortcuts

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