Documentation ¶
Overview ¶
Package store provides a simple and convenient data store interface for plugins to persist data along with a default filed-based leveldb implementation.
Index ¶
- type BytesStorer
- type LevelDB
- func (ldb *LevelDB) Close() (err error)
- func (ldb *LevelDB) Get(key []byte) (value []byte, err error)
- func (ldb *LevelDB) GetString(key string) (value string, err error)
- func (ldb *LevelDB) Put(key []byte, value []byte) (err error)
- func (ldb *LevelDB) PutString(key string, value string) (err error)
- func (ldb *LevelDB) Scan() (entries map[string]string, err error)
- type Scanner
- type StringStorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesStorer ¶
type BytesStorer interface { io.Closer Scanner Get(key []byte) (value []byte, err error) Put(key []byte, value []byte) (err error) }
BytesStorer is implemented by any value that has the Get/Put/Scan and Closer methods on byte arrays for keys/values.
type LevelDB ¶
type LevelDB struct { Name string // contains filtered or unexported fields }
LevelDB holds a datastore name and its leveldb instance
func NewLevelDB ¶
NewLevelDB instantiates and open a new LevelDB instance backed by a leveldb database. If the leveldb database doesn't exist, one is created
type Scanner ¶
Scanner is implemented by any value that has the Scan method returning all key/values as strings.
Since []byte aren't allowed as map keys, we use don't have an equivalent Scanner interface returning the data as bytes. For implementers, it should be easy to convert the []byte values to string with a simple string(value) conversion as strings are immutable arrays of bytes