engine

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrReadOnlyTx    = errors.New("cannot execute a write operation in a read only transaction")
	ErrAlreadyExists = errors.New("specified key already exists in the database")
)

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Engine returns the engine name and is used for debugging and logging.
	Engine() string

	// Close the engine so that it no longer can be accessed.
	Close() error

	// Begin a transaction to issue multiple commands (this is an internal transaction
	// for Honu-specific version management, not an external interface).
	Begin(readonly bool) (tx Transaction, err error)
}

Engines are the disk storage mechanism that Honu wraps. Users may chose different engines for a variety of reasons, including variable performance benefits, different features, or even implement heterogeneous Honu networks composed of different engines.

type Iterator

type Iterator interface {
	Iter(prefix []byte, options *opts.Options) (i iterator.Iterator, err error)
}

Iterator engines allow queries that scan a range of consecutive keys.

type Store

type Store interface {
	Has(key []byte, options *opts.Options) (exists bool, err error)
	Get(key []byte, options *opts.Options) (value []byte, err error)
	Put(key, value []byte, options *opts.Options) error
	Delete(key []byte, options *opts.Options) error
}

Store is a simple key/value interface that allows for Get, Put, and Delete. Nearly all engines should support the Store interface.

type Transaction added in v0.2.2

type Transaction interface {
	Store
	Finish() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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