Documentation ¶
Index ¶
- Variables
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) Configured() bool
- func (b *Backend) CreateIfExists(ctx context.Context, condKey, key string, value []byte) error
- func (b *Backend) CreateOnly(ctx context.Context, key string, value []byte) (bool, error)
- func (b *Backend) Decode(in string) ([]byte, error)
- func (b *Backend) Delete(ctx context.Context, key string) error
- func (b *Backend) DeletePrefix(ctx context.Context, path string) error
- func (b *Backend) Encode(in []byte) string
- func (b *Backend) Exists(ctx context.Context, key string) (bool, error)
- func (b *Backend) Get(ctx context.Context, key string) (*types.Value, error)
- func (b *Backend) GetName() string
- func (b *Backend) GetPrefix(ctx context.Context, path string) (string, *types.Value, error)
- func (b *Backend) KeyDoesNotExistError(err error) bool
- func (b *Backend) ListPrefix(ctx context.Context, path string) (types.KeyValuePairs, error)
- func (b *Backend) ListPrefixKeys(ctx context.Context, path string) ([]string, error)
- func (b *Backend) PrefixScanWithFunction(ctx context.Context, key string, f types.KVPairStructFunc)
- func (b *Backend) Set(ctx context.Context, key string, value []byte) error
- func (b *Backend) Status() (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyAlreadyExist represent the error when the key is already present in the key // value store. ErrKeyAlreadyExist = errors.New("key already exist in the key value store") )
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is the backend for badger key value store for xene.
func NewBadgerBackend ¶
NewBadgerBackend configures and returns badger backend.
func (*Backend) Close ¶
Close closes the database client and does not allow to do any more transactions.
func (*Backend) Configured ¶
Configured returns if the backend client has been configured or not.
func (*Backend) CreateIfExists ¶
CreateIfExists creates a key with the value only if key condKey exists
func (*Backend) CreateOnly ¶
CreateOnly atomically creates a key or fails if it already exists
func (*Backend) Decode ¶
Decode decodes a key previously encoded back into the original binary slice
func (*Backend) DeletePrefix ¶
DeletePrefix deletes the first key which matches the prefix and its value.
func (*Backend) Encode ¶
Encode encodes a binary slice into a character set that the backend supports
func (*Backend) KeyDoesNotExistError ¶
KeyDoesNotExistError checks if the provided error is due to non existance of the key or not.
func (*Backend) ListPrefix ¶
ListPrefix returns a list of keys matching the prefix This is best effort.
func (*Backend) ListPrefixKeys ¶
ListPrefixKeys returns a list of keys matching the prefix This is best effort.
func (*Backend) PrefixScanWithFunction ¶
PrefixScanWithFunction scans the provided key prefix keys in the store and run the provided function for each one of them.