db

package
v0.5.68 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotRunning    = DBError("DB is not running")
	ErrWrongPassword = DBError("wrong username or password")

	PermanentTTL = math.MaxInt64
)

Variables

View Source
var DefaultIteratorOptions = badger.DefaultIteratorOptions

Functions

func DecodeInt64

func DecodeInt64(b []byte) int64

func EncodeInt64

func EncodeInt64(n int64) []byte

func IsNotFoundError

func IsNotFoundError(err error) bool

Types

type Batch

type Batch = ds.Batch

type Batching

type Batching = ds.Batching

type CustomTransaction

type CustomTransaction interface {
	ds.Txn
	NewIterator(opt IteratorOptions) (*Iterator, error)
	PutWithTTL(ctx context.Context, key DatastoreKey, value []byte, ttl time.Duration) error
	Increment(key DatastoreKey) (uint64, error)
	Decrement(key DatastoreKey) (uint64, error)
}

type DBError

type DBError string

func (DBError) Error

func (e DBError) Error() string

type Datastore

type Datastore = ds.Datastore

type DatastoreKey

type DatastoreKey = ds.Key

func NewKey

func NewKey(s string) DatastoreKey

type Iterator

type Iterator = badger.Iterator

type IteratorOptions

type IteratorOptions = badger.IteratorOptions

type LocalDatastore

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

func NewLocalDatastore

func NewLocalDatastore(dbPath string, o *Options) (*LocalDatastore, error)

func (*LocalDatastore) Batch

func (d *LocalDatastore) Batch(ctx context.Context) (Batch, error)

func (*LocalDatastore) Close

func (d *LocalDatastore) Close() error

func (*LocalDatastore) Delete

func (d *LocalDatastore) Delete(ctx context.Context, key DatastoreKey) error

func (*LocalDatastore) DiskUsage

func (d *LocalDatastore) DiskUsage(ctx context.Context) (uint64, error)

func (*LocalDatastore) Get

func (d *LocalDatastore) Get(ctx context.Context, key DatastoreKey) (value []byte, err error)

func (*LocalDatastore) GetSize

func (d *LocalDatastore) GetSize(ctx context.Context, key DatastoreKey) (size int, err error)

func (*LocalDatastore) Has

func (d *LocalDatastore) Has(ctx context.Context, key DatastoreKey) (bool, error)

func (*LocalDatastore) IsFirstRun

func (d *LocalDatastore) IsFirstRun() bool

func (*LocalDatastore) NewCustomTransaction

func (d *LocalDatastore) NewCustomTransaction(ctx context.Context, readOnly bool) (CustomTransaction, error)

func (*LocalDatastore) NewDagStore

func (d *LocalDatastore) NewDagStore(ctx context.Context) (*dagStore, error)

func (*LocalDatastore) NewTransaction

func (d *LocalDatastore) NewTransaction(ctx context.Context, readOnly bool) (ds.Txn, error)

func (*LocalDatastore) Put

func (d *LocalDatastore) Put(ctx context.Context, key DatastoreKey, value []byte) error

func (*LocalDatastore) PutWithTTL

func (d *LocalDatastore) PutWithTTL(ctx context.Context, key DatastoreKey, value []byte, ttl time.Duration) error

func (*LocalDatastore) Query

func (d *LocalDatastore) Query(ctx context.Context, q dsq.Query) (dsq.Results, error)

func (*LocalDatastore) Run

func (d *LocalDatastore) Run(username, password string) (err error)

func (*LocalDatastore) Stats

func (d *LocalDatastore) Stats() map[string]string

func (*LocalDatastore) Sync

type Options

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

func DefaultOptions

func DefaultOptions() *Options

func (Options) WithDiscardRatioGC

func (opt Options) WithDiscardRatioGC(ratio float64) Options

func (Options) WithInMemory

func (opt Options) WithInMemory(v bool) Options

func (Options) WithIntervalGC

func (opt Options) WithIntervalGC(interval time.Duration) Options

func (Options) WithSleepGC

func (opt Options) WithSleepGC(sleep time.Duration) Options

Jump to

Keyboard shortcuts

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