core

package
v0.0.0-...-17dc2c5 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package core provides the core BitDB implementation.

Index

Constants

This section is empty.

Variables

View Source
var ErrChecksumMismatch = errors.New("checksum mismatch")
View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

This section is empty.

Types

type DB

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

func Open

func Open(dir string, opts ...Option) (rdb *DB, rerr error)

func SetupTempDB

func SetupTempDB(tb testing.TB, dbOpts ...Option) (db *DB, path string, cleanup func())

func (*DB) AbortOpen

func (db *DB) AbortOpen() (errs error)

AbortOpen In case a failure happens during Open, we need to clean-up stuff opened so far. Keeping this separate from Close, which ensures graceful shutdown.

func (*DB) Close

func (db *DB) Close() (errs error)

func (*DB) Delete

func (db *DB) Delete(key string) error

func (*DB) DiskSize

func (db *DB) DiskSize() (int64, error)

DiskSize returns the sum of all on-disk segment file sizes.

func (*DB) Get

func (db *DB) Get(key string) (string, error)

func (*DB) MergeErrors

func (db *DB) MergeErrors() <-chan error

func (*DB) Set

func (db *DB) Set(key, val string) error

type Option

type Option func(*DB)

func WithChecksumEnabled

func WithChecksumEnabled(b bool) Option

func WithFsync

func WithFsync(b bool) Option

func WithMergeEnabled

func WithMergeEnabled(b bool) Option

func WithMergeThreshold

func WithMergeThreshold(n int) Option

func WithOnMergeApply

func WithOnMergeApply(f func()) Option

func WithOnMergeStart

func WithOnMergeStart(f func()) Option

func WithRolloverThreshold

func WithRolloverThreshold(n int64) Option

type WriteType

type WriteType int8
const (
	TypeDelete WriteType = iota
	TypeSet
)

Jump to

Keyboard shortcuts

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