pebble

package
v0.0.0-...-7781947 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: BSD-3-Clause Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidOperation = errors.New("invalid operation")
)

Functions

func New

func New(file string, cfg Config) (database.Database, error)

Types

type Config

type Config struct {
	CacheSize                   int // B
	BytesPerSync                int // B
	WALBytesPerSync             int // B (0 disables)
	MemTableStopWritesThreshold int // num tables
	MemTableSize                int // B
	MaxOpenFiles                int
}

func NewDefaultConfig

func NewDefaultConfig() Config

type Database

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

func (*Database) Close

func (db *Database) Close() error

func (*Database) Compact

func (db *Database) Compact(start []byte, limit []byte) error

func (*Database) Delete

func (db *Database) Delete(key []byte) error

Delete removes the key from the database

func (*Database) Get

func (db *Database) Get(key []byte) ([]byte, error)

Get returns the value the key maps to in the database

func (*Database) Has

func (db *Database) Has(key []byte) (bool, error)

Has returns if the key is set in the database

func (*Database) HealthCheck

func (db *Database) HealthCheck(_ context.Context) (interface{}, error)

func (*Database) NewBatch

func (db *Database) NewBatch() database.Batch

NewBatch creates a write/delete-only buffer that is atomically committed to the database when write is called

func (*Database) NewIterator

func (db *Database) NewIterator() database.Iterator

NewIterator creates a lexicographically ordered iterator over the database

func (*Database) NewIteratorWithPrefix

func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator

NewIteratorWithPrefix creates a lexicographically ordered iterator over the database ignoring keys that do not start with the provided prefix

func (*Database) NewIteratorWithStart

func (db *Database) NewIteratorWithStart(start []byte) database.Iterator

NewIteratorWithStart creates a lexicographically ordered iterator over the database starting at the provided key

func (*Database) NewIteratorWithStartAndPrefix

func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

NewIteratorWithStartAndPrefix creates a lexicographically ordered iterator over the database starting at start and ignoring keys that do not start with the provided prefix.

Prefix should be some key contained within [start] or else the lower bound of the iteration will be overwritten with [start].

func (*Database) Put

func (db *Database) Put(key []byte, value []byte) error

Put sets the value of the provided key to the provided value

Jump to

Keyboard shortcuts

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