badgerstorage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValueLogMaxEntries  = uint32(1024 * 1024 * 1024)
	KeyRotationDuration = time.Hour * 24 * 7

	KeySize = 32

	DataFolderPerm = os.FileMode(0755)

	MaxPendingWrites = 4096

	ErrInvalidKeySize   = errors.New("invalid key size")
	ErrCanceled         = errors.New("operation was canceled")
	ErrDatabaseExist    = errors.New("database exist")
	ErrDatabaseNotExist = errors.New("database not exist")
	ErrItemNotExist     = errors.New("item not exist")
)

Functions

func CreateDatabase

func CreateDatabase(conf *BadgerConfig) error

func DatabaseExist

func DatabaseExist(dataDir string) bool

func FromDB

func FromDB(db *badger.DB) storage.ManagedStorage

func New

func NewLogger

func NewLogger(debug bool) badger.Logger

func NewZapLogger

func NewZapLogger(log *zap.Logger, debug bool) badger.Logger

func OpenDatabase

func OpenDatabase(conf *BadgerConfig) (*badger.DB, error)

Types

type BadgerAction

type BadgerAction uint8
const (
	DeleteIfExist BadgerAction = iota
	CreateIfNotExist
)

type BadgerConfig

type BadgerConfig struct {
	DataDir    string
	Action     BadgerAction
	StorageKey []byte // optional
	UseZSTD    bool
	TruncateDB bool
	Debug      bool
	Log        *zap.Logger // optional
}

Jump to

Keyboard shortcuts

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