Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
BoltStore implements the KVStore with boltDB as backend; it uses a single bucket to simplify interaction with DB.
func NewBoltStore ¶
NewBoltStore returns a NewBoltStore instance; it will open the BoltDB and create the bucket if needed. It is by design that only one bucket is used per DB and its name is fixed.
func (*BoltStore) Get ¶
Get copies the returning []byte from db.View() to make sure it keeps valid outside the transaction. Refer to https://github.com/boltdb/bolt#using-keyvalue-pairs.
type KVStore ¶
type KVStore interface { // Get retrieves the value by certain key, // and returns nil if key is not existed. Get(key []byte) (value []byte, err error) // Set stores the key-value pair with // the update-if-existed fashion. Set(key, value []byte) error }
KVStore is a simple key-value database.
Click to show internal directories.
Click to hide internal directories.