engine

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("local engine: key not found")

ErrNotFound indicates no key is found when trying Get or Seek an entry from DB.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	// Put appends 'put operation' of the key/value to the batch.
	Put(key []byte, value []byte)
	// Delete appends 'delete operation' of the key/value to the batch.
	Delete(key []byte)
	// Len return length of the batch
	Len() int
}

Batch is the interface for local storage.

type DB

type DB interface {
	// Get gets the associated value with key, returns (nil, ErrNotFound) if no value found.
	Get(key []byte) ([]byte, error)
	// Seek searches for the first key in the engine which is >= key in byte order, returns (nil, nil, ErrNotFound)
	// if such key is not found.
	Seek(key []byte) ([]byte, []byte, error)
	// SeekReverse searches the engine in backward order for the first key-value pair which key is less than the key
	// in byte order, returns (nil, nil, ErrNotFound) if such key is not found. If key is nil, the last key is returned.
	SeekReverse(key []byte) ([]byte, []byte, error)
	// NewBatch creates a Batch for writing.
	NewBatch() Batch
	// Commit writes the changed data in Batch.
	Commit(b Batch) error
	// Close closes database.
	Close() error
}

DB is the interface for local storage.

type Driver

type Driver interface {
	// Open opens or creates a local storage DB.
	// The schema is a string for a local storage DB specific format.
	Open(schema string) (DB, error)
}

Driver is the interface that must be implemented by a local storage db engine.

type MSeekResult

type MSeekResult struct {
	Key   []byte
	Value []byte
	Err   error
}

MSeekResult is used to get multiple seek results.

Jump to

Keyboard shortcuts

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