.. | ||
bitcask_search_test.go | ||
bitcask_search.go | ||
bitcask_test.go | ||
bitcask.go | ||
errors.go | ||
keyvalue_test.go | ||
keyvalue.go | ||
README.md |
bitcask
type DB
type DB struct {
}
DB is a mapper of a Filer and Searcher implementation using Bitcask.
func OpenDB
func OpenDB(path string) *DB
OpenDB will either open an existing set of bitcask datastores at the given directory, or it will create a new one.
func (*DB) Close
func (db *DB) Close(bucketName string) error
Close is a simple shim for bitcask's Close function.
func (*DB) CloseAll
func (db *DB) CloseAll() error
CloseAll closes all bitcask datastores.
func (*DB) Init
func (db *DB) Init(bucketName string) error
Init opens a bitcask store at the given path to be referenced by bucketName.
func (*DB) Path
func (db *DB) Path() string
Path returns the base path where we store our bitcask "buckets".
func (*DB) Sync
func (db *DB) Sync(bucketName string) error
Sync is a simple shim for bitcask's Sync function.
func (*DB) SyncAll
func (db *DB) SyncAll() error
SyncAll syncs all bitcask datastores.
func (*DB) SyncAndCloseAll
func (db *DB) SyncAndCloseAll() error
SyncAndCloseAll implements the method from Keeper.
func (*DB) With
func (db *DB) With(bucketName string) Store
With calls the given underlying bitcask instance.
type Key
type Key struct {
database.Key
}
Key represents a key in a key/value store.
func (Key) Bytes
func (k Key) Bytes() []byte
Bytes returns the raw byte slice form of the Key.
func (Key) Equal
func (k Key) Equal(k2 Key) bool
Equal determines if two keys are equal.
func (Key) String
func (k Key) String() string
String returns the string slice form of the Key.
type KeyValue
type KeyValue struct {
Key Key
Value Value
}
KeyValue represents a key and a value from a key/balue store.
type Store
type Store struct {
*bitcask.Bitcask
database.Searcher
}
Store is an implmentation of a Filer and a Searcher using Bitcask.
func (Store) AllKeys
func (c Store) AllKeys() (keys [][]byte)
AllKeys will return all keys in the database as a slice of byte slices.
func (Store) PrefixScan
func (c Store) PrefixScan(prefix string) ([]KeyValue, error)
PrefixScan will scan a Store for all keys that have a matching prefix of the given string and return a map of keys and values. (map[Key]Value)
func (Store) Search
func (c Store) Search(query string) ([]KeyValue, error)
Search will search for a given string within all values inside of a Store. Note, type casting will be necessary. (e.g: []byte or string)
func (Store) ValueExists
func (c Store) ValueExists(value []byte) (key []byte, ok bool)
ValueExists will check for the existence of a Value anywhere within the keyspace, returning the Key and true if found, or nil and false if not found.
type Value
type Value struct {
database.Value
}
Value represents a value in a key/value store.
func (Value) Bytes
func (v Value) Bytes() []byte
Bytes returns the raw byte slice form of the Value.
func (Value) Equal
func (v Value) Equal(v2 Value) bool
Equal determines if two values are equal.
func (Value) String
func (v Value) String() string
String returns the string slice form of the Value.