database

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDatabaseClosed is returned if a database was already closed at the
	// invocation of a data access operation.
	ErrDatabaseClosed = errors.New("database closed")

	// ErrDatabaseNotFound is returned if a key is requested that is not found in
	// the provided database.
	ErrDatabaseNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type Batcher

type Batcher interface {
	KeyValueWriter

	// Write flushes any accumulated data to disk.
	Write() error

	// Reset resets the batch for reuse.
	Reset()

	// ValueSize retrieves the amount of data queued up for writing.
	ValueSize() int
}

type KeyValueReader

type KeyValueReader interface {
	// Has retrieves if a key is present in the key-value data store.
	Has(key []byte) (bool, error)

	// Get retrieves the given key if it's present in the key-value data store.
	Get(key []byte) ([]byte, error)
}

type KeyValueWriter

type KeyValueWriter interface {
	// Set inserts the given value into the key-value data store.
	Set(key []byte, value []byte) error

	// Delete removes the key from the key-value data store.
	Delete(key []byte) error
}

type TreeDB

type TreeDB interface {
	KeyValueReader
	KeyValueWriter
	// NewBatch creates a write-only database that buffers changes to its host db
	// until a final write is called.
	NewBatch() Batcher
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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