Documentation ¶
Index ¶
Constants ¶
View Source
const (
KeyLength = 32 // Total bytes used for keys
)
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
ErrNotFound is returned by KeyValueDB.Get if the key is not found.
View Source
var ErrNotOpen = errors.New("not open")
ErrNotOpen is returned by KeyValueDB.Get, .Put, and .Close if the database is not open.
Functions ¶
This section is empty.
Types ¶
type Key ¶
func (Key) MarshalJSON ¶
MarshalJSON is implemented for JSON-based logging
type KeyValueStore ¶
type KeyValueStore interface { Close() error // Returns an error if the close fails InitDB(filepath string, logger Logger) error // Sets up the database, returns error if it fails Get(key Key) (value []byte, err error) // Get key from database, returns ErrNotFound if the key is not found Put(key Key, value []byte) error // Put the value in the database, throws an error if fails EndBatch(map[Key][]byte) error // End and commit a batch of transactions Begin() KeyValueTxn }
type KeyValueTxn ¶
Click to show internal directories.
Click to hide internal directories.