badger

package
v0.0.0-...-2c3b082 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

badger doesn't do structured logging but is instead using Debugf and formats the strings with parameters. That makes analyzis a bit tricky since the same log print might differ, for instance startup time. This is a small improvement, the logs are ugly but it's possible to group and filter them

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterModel

type CounterModel interface {
	Model
	IncGlobal(context.Context) (uint64, error)
	IncWord(context.Context, string) (uint64, error)
}

type DB

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

func New

func New(ctx context.Context, p string) *DB

func (*DB) Close

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

Close closes the database. The context is there to adher to the shutdown func definition

func (*DB) EnsureDB

func (db *DB) EnsureDB(ctx context.Context) error

func (*DB) Healthy

func (db *DB) Healthy(_ context.Context) bool

func (*DB) Open

func (db *DB) Open(_ context.Context) error

func (*DB) TearDown

func (db *DB) TearDown(_ context.Context) error

TearDown doesn't need to cascade on a DB level since it can just Drop all and delete the DB file

type Logger

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

func NewLogger

func NewLogger() *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(f string, v ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(f string, v ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(f string, v ...any)

func (*Logger) Warningf

func (l *Logger) Warningf(f string, v ...interface{})

type Model

type Model interface {
	// EnsureDB should be idempotent, making sure the db is in an expected state
	// ie tables/namespaces/indices etc should exist after a call. it should be safe to run at start, so not
	// dropping and recreating tables or such
	EnsureDB(context.Context) error
	// TearDown is destructive and purges all data, useful for integration tests
	TearDown(context.Context) error
	// Close closes anything needed
	Close(context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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