kvstore

package
v0.0.0-...-5de3a08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func AtomicModify

func AtomicModify(s KVStore, key string, modify func(initialValue []byte, storeErr error) ([]byte, error)) error

func AtomicModifyWithOptions

func AtomicModifyWithOptions(s KVStore, key string, modify func(initialValue []byte, storeErr error) ([]byte, *model.PluginKVSetOptions, error)) error

func Ensure

func Ensure(s KVStore, key string, newValue []byte) ([]byte, error)

func LoadJSON

func LoadJSON(s KVStore, key string, v interface{}) (returnErr error)

func StoreJSON

func StoreJSON(s KVStore, key string, v interface{}) (returnErr error)

Types

type KVStore

type KVStore interface {
	Load(key string) ([]byte, error)
	Store(key string, data []byte) error
	StoreTTL(key string, data []byte, ttlSeconds int64) error
	StoreWithOptions(key string, value []byte, opts model.PluginKVSetOptions) (bool, error)
	Delete(key string) error
}

func NewEncryptedKeyStore

func NewEncryptedKeyStore(s KVStore, encryptionKey []byte) KVStore

func NewHashedKeyStore

func NewHashedKeyStore(s KVStore, prefix string) KVStore

func NewPluginStore

func NewPluginStore(api plugin.API) KVStore

func NewPluginStoreWithExpiry

func NewPluginStoreWithExpiry(api plugin.API, ttl time.Duration) KVStore

type OneTimeStore

type OneTimeStore KVStore

OneTimeStore is a KV store that deletes each record after the first load,

func NewOneTimePluginStore

func NewOneTimePluginStore(api plugin.API, ttl time.Duration) OneTimeStore

func NewOneTimeStore

func NewOneTimeStore(kv KVStore) OneTimeStore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL