badger

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBlockCacheSize = 1610612736 // 1.5GB (increased from 768MB)
	DefaultIndexCacheSize = 536870912  // 512MB (increased from 256MB)
)

Default cache sizes for BadgerDB (in bytes)

Variables

This section is empty.

Functions

func NewFromCmdlineOptions added in v0.18.0

func NewFromCmdlineOptions() plugin.Plugin

Types

type BadgerLogger

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

BadgerLogger is a wrapper type to give our logger the expected interface

func NewBadgerLogger

func NewBadgerLogger(logger *slog.Logger) *BadgerLogger

func (*BadgerLogger) Debugf

func (b *BadgerLogger) Debugf(msg string, args ...any)

func (*BadgerLogger) Errorf

func (b *BadgerLogger) Errorf(msg string, args ...any)

func (*BadgerLogger) Infof

func (b *BadgerLogger) Infof(msg string, args ...any)

func (*BadgerLogger) Warningf

func (b *BadgerLogger) Warningf(msg string, args ...any)

type BlobStoreBadger

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

BlobStoreBadger stores all data in badger. Data may not be persisted

func New

New creates a new database

func (*BlobStoreBadger) Close

func (d *BlobStoreBadger) Close() error

Close gets the database handle from our BlobStore and closes it

func (*BlobStoreBadger) DB

func (d *BlobStoreBadger) DB() *badger.DB

DB returns the database handle

func (*BlobStoreBadger) GetCommitTimestamp

func (b *BlobStoreBadger) GetCommitTimestamp() (int64, error)

func (*BlobStoreBadger) NewTransaction

func (d *BlobStoreBadger) NewTransaction(update bool) *badger.Txn

NewTransaction creates a new badger transaction

func (*BlobStoreBadger) SetCommitTimestamp

func (b *BlobStoreBadger) SetCommitTimestamp(
	txn *badger.Txn,
	timestamp int64,
) error

func (*BlobStoreBadger) Start added in v0.18.0

func (d *BlobStoreBadger) Start() error

Start implements the plugin.Plugin interface

func (*BlobStoreBadger) Stop added in v0.18.0

func (d *BlobStoreBadger) Stop() error

Stop implements the plugin.Plugin interface

type BlobStoreBadgerOptionFunc added in v0.18.0

type BlobStoreBadgerOptionFunc func(*BlobStoreBadger)

func WithBlockCacheSize added in v0.18.0

func WithBlockCacheSize(size uint64) BlobStoreBadgerOptionFunc

WithBlockCacheSize specifies the block cache size

func WithDataDir added in v0.18.0

func WithDataDir(dataDir string) BlobStoreBadgerOptionFunc

WithDataDir specifies the data directory to use for storage

func WithGc added in v0.18.0

func WithGc(enabled bool) BlobStoreBadgerOptionFunc

WithGc specifies whether garbage collection is enabled

func WithIndexCacheSize added in v0.18.0

func WithIndexCacheSize(size uint64) BlobStoreBadgerOptionFunc

WithIndexCacheSize specifies the index cache size

func WithLogger added in v0.18.0

func WithLogger(logger *slog.Logger) BlobStoreBadgerOptionFunc

WithLogger specifies the logger object to use for logging messages

func WithPromRegistry added in v0.18.0

func WithPromRegistry(
	registry prometheus.Registerer,
) BlobStoreBadgerOptionFunc

WithPromRegistry specifies the prometheus registry to use for metrics

Jump to

Keyboard shortcuts

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