Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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)
}
Batch is the interface for local storage
type DB ¶
type DB interface {
// Get the associated value with key
// return nil, nil if no value found
Get(key []byte) ([]byte, error)
// Getsnapshot generates a snapshot for current DB
GetSnapshot() (Snapshot, 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 Iterator ¶
type Iterator interface {
// Next moves the iterator to the next key/value pair,
// returns true/false if the iterator is exhausted
Next() bool
// Key returns the current key of the key/value pair or nil
// if the iterator is done.
Key() []byte
// Values returns the current value of the key/value pair or nil
// if the iterator is done.
Value() []byte
// Release releases current iterator.
Release()
}
Iterator is the interface for local storage
type Snapshot ¶
type Snapshot interface {
// Get the associated value with key in this snapshot
// return nil, nil if no value found
Get(key []byte) ([]byte, error)
// NewIterator creates an iterator, seeks the iterator to
// the first key >= startKey.
NewIterator(startKey []byte) Iterator
// Release releases the snapshot
Release()
}
Snapshot is the interface for local storage
Click to show internal directories.
Click to hide internal directories.