boltutil

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB added in v0.34.0

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

DB gates transactions so compaction can replace the underlying handle.

func Open

func Open(p string, mode fs.FileMode, options *bolt.Options, policies ...compaction.Config) (*DB, error)

func SafeOpen added in v0.27.0

func SafeOpen(dbPath string, mode os.FileMode, opts *bolt.Options, policies ...compaction.Config) (*DB, error)

SafeOpen opens a bolt database with automatic recovery from corruption. If the database file is corrupted, it backs up the corrupted file and creates a new empty database. This is useful for disposable databases like cache or history where data loss is acceptable but startup failure is not.

func (*DB) Close added in v0.34.0

func (d *DB) Close() error

func (*DB) Compact added in v0.34.0

func (d *DB) Compact(ctx context.Context, opt db.CompactOptions) (db.CompactResult, error)

Compact pauses transactions while copying live data to a replacement file. It requires enough free disk space to hold both files until replacement.

func (*DB) CompactionStats added in v0.34.0

func (d *DB) CompactionStats() (db.CompactionStats, error)

func (*DB) Update added in v0.34.0

func (d *DB) Update(fn func(*bolt.Tx) error) error

func (*DB) View added in v0.34.0

func (d *DB) View(fn func(*bolt.Tx) error) error

Jump to

Keyboard shortcuts

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