Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEncryptionKeyNotProvided = errors.New("encryption key not provided") ErrBackupEncryptionKeyNotProvided = errors.New("backup encryption key not provided") )
Functions ¶
Types ¶
type BadgerBackupMeta ¶ added in v0.3.1
type BadgerBackupMeta struct {
Algo string `json:"algo"` // AES-256-GCM
NonceB64 string `json:"nonce_b64"` // base64 nonce
CreatedAt string `json:"created_at"` // RFC3339
Since uint64 `json:"since"` // input watermark
NextSince uint64 `json:"next_since"` // output watermark
EncryptionKeyID string `json:"encryption_key_id"` // sha256(key) prefix
}
type BadgerBackupVersionInfo ¶ added in v0.3.1
type BadgerConfig ¶ added in v0.3.1
type BadgerKVStore ¶
BadgerKVStore is an implementation of the KVStore interface using BadgerDB.
func NewBadgerKVStore ¶
func NewBadgerKVStore(config BadgerConfig) (*BadgerKVStore, error)
NewBadgerKVStore creates a new BadgerKVStore instance.
func (*BadgerKVStore) Backup ¶ added in v0.3.1
func (b *BadgerKVStore) Backup() error
func (*BadgerKVStore) Delete ¶
func (b *BadgerKVStore) Delete(key string) error
Delete removes a key-value pair from BadgerDB.
func (*BadgerKVStore) Get ¶
func (b *BadgerKVStore) Get(key string) ([]byte, error)
Get retrieves the value associated with a key from BadgerDB.
func (*BadgerKVStore) Keys ¶
func (b *BadgerKVStore) Keys() ([]string, error)
type KVStore ¶
type KVStore interface {
// Put stores a key-value pair in the store.
Put(key string, value []byte) error
// Get retrieves the value associated with a key. If the key is not found, it returns an empty slice.
Get(key string) ([]byte, error)
// Delete removes a key-value pair from the store.
Delete(key string) error
// Close closes the key-value store.
Close() error
Backup() error
}
KVStore defines the interface for a key-value store.
Click to show internal directories.
Click to hide internal directories.