Documentation ¶
Overview ¶
Package backend implements the persistent AzmoDB backend key/value database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { // Range performs fn on all values stored in the database at rev. // If fn returns an errors the traversal is stopped and the error // is returned. Range(rev Revision, fn func(key []byte, value []byte) error) error // Batch starts a new batch transaction. Starting multiple write // batch transactions will cause the calls to block and be // serialized until the current write batch transaction finishes. Batch(rev Revision) (Batch, error) // Last returns the last revision in the database and an error if // any. Last() (Revision, error) }
Backend represents a persistent AzmoDB backend.
type Batch ¶
type Batch interface { // Put sets the value for a key in the database. Put must create a // copy of the supplied key and value. Put(key []byte, value []byte) error // Close closes the batch transaction. Close() error }
Batch returns a batch transaction on the database.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents the default AzmoDB backend. DB represents a collection of buckets persisted to a file on disk. All data access is performed through transactions which can be obtained through the DB.
func Open ¶
Open creates and opens a database at the given path. If the file does not exist then it will be created automatically.
Timeout is the amount of time to wait to obtain a file lock. When set to zero it will wait indefinitely. This option is only available on Darwin and Linux.
func (*DB) Batch ¶
Batch starts a new batch transaction. Starting multiple write batch transactions will cause the calls to block and be serialized until the current write batch transaction finishes.
func (*DB) Close ¶
Close releases all database resources. All batch transactions must be closed before closing the database.
type Option ¶
Option represents a DB option function.
func WithMaxBatchEntries ¶
WithMaxBatchEntries configures the maximum batch entries.
func WithMaxBatchSize ¶
WithMaxBatchSize configures the maximum batch size.