Documentation
¶
Index ¶
- Variables
- func SetDefaultPogrebOptions(pogrebopts ...any)
- type DB
- func (db *DB) AllStores() map[string]database.Filer
- func (db *DB) Close(storeName string) error
- func (db *DB) CloseAll() error
- func (db *DB) Discover() ([]string, error)
- func (db *DB) Init(storeName string, opts ...any) error
- func (db *DB) Path() string
- func (db *DB) Sync(storeName string) error
- func (db *DB) SyncAll() error
- func (db *DB) SyncAndCloseAll() error
- func (db *DB) With(storeName string) database.Store
- func (db *DB) WithNew(storeName string, opts ...any) database.Filer
- type Option
- type Store
- func (pstore *Store) Backend() any
- func (pstore *Store) Has(key []byte) bool
- func (pstore *Store) Keys() [][]byte
- func (pstore *Store) Len() int
- func (pstore *Store) PrefixScan(prefixs string) (<-chan *kv.KeyValue, chan error)
- func (pstore *Store) Search(query string) (<-chan *kv.KeyValue, chan error)
- func (pstore *Store) ValueExists(value []byte) (key []byte, ok bool)
- type WrappedOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownAction = errors.New("unknown action") ErrBogusStore = errors.New("bogus store backend") ErrBadOptions = errors.New("invalid pogreb options") ErrStoreExists = errors.New("store name already exists") ErrNoStores = errors.New("no stores initialized") )
var OptionAllowRecovery = func(opts *WrappedOptions) { opts.AllowRecovery = true }
Functions ¶
func SetDefaultPogrebOptions ¶
func SetDefaultPogrebOptions(pogrebopts ...any)
SetDefaultPogrebOptions options will set the options used for all subsequent pogreb stores that are initialized.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a mapper of a Filer and Searcher implementation using pogreb.
func OpenDB ¶
OpenDB will either open an existing set of pogreb datastores at the given directory, or it will create a new one.
func (*DB) AllStores ¶
AllStores returns a map of the names of all pogreb datastores and the corresponding Filers.
func (*DB) Discover ¶
Discover will discover and initialize all existing bitcask stores at the path opened by OpenDB.
func (*DB) SyncAndCloseAll ¶
SyncAndCloseAll implements the method from Keeper to sync and close all pogreb stores.
type Option ¶
type Option func(*WrappedOptions)
func AllowRecovery ¶
func AllowRecovery() Option
func SetPogrebOptions ¶
type Store ¶
Store is an implmentation of a Filer and a Searcher using Bitcask.
func (*Store) PrefixScan ¶
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) error channel will block, so be sure to read from it.