kvstore

package
v0.0.0-...-b215688 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

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 NameFromID

func NameFromID(id types.ID) string

func StoreJSON

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

Types

type EntityStore

type EntityStore interface {
	Delete(types.ID) error
	Load(types.ID, interface{}) error
	NewID(name string) (types.ID, error)
	Store(types.ID, interface{}) error
}

type IDIndexStore

type IDIndexStore interface {
	Load() (*types.IDSet, error)
	Store(*types.IDSet) error
	Delete(types.ID) error
	Set(types.ID) (bool, error)
}

type KVStore

type KVStore interface {
	Load(key string) ([]byte, error)
	Store(key string, data []byte) error
	StoreTTL(key string, data []byte, ttlSeconds int64) error
	Delete(key string) error
	Keys() ([]string, error)
	Flush() []error
}

func NewCacheKVStore

func NewCacheKVStore(s KVStore) 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

type Store

type Store interface {
	KVStore

	Entity(string) EntityStore
	ValueIndex(string, types.ValueArray) ValueIndexStore
	IDIndex(string) IDIndexStore
}

func NewStore

func NewStore(kv KVStore) Store

type ValueIndexStore

type ValueIndexStore interface {
	Load() (*types.ValueSet, error)
	Store(*types.ValueSet) error
	Delete(id types.ID) error
	StoreValue(v types.Value) error
}

Jump to

Keyboard shortcuts

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