diff options
author | Valery Piashchynski <[email protected]> | 2021-08-12 15:38:19 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-12 15:38:19 +0300 |
commit | df27287c78d7b17d7c8f0e7fff59fa7cbf2a4f9f (patch) | |
tree | df0749155487eae6bcdbb2456885131a21916f4d /common/kv/interface.go | |
parent | 67db4b5f7b66e9a32713133baed83c3ab7146bb8 (diff) | |
parent | ecbfc5c5265a9895f4e371ce4388f64df8714e63 (diff) |
#726: feat(plugin): new `jobs` plugin
#726: feat(plugin): new `jobs` plugin
Diffstat (limited to 'common/kv/interface.go')
-rw-r--r-- | common/kv/interface.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/common/kv/interface.go b/common/kv/interface.go new file mode 100644 index 00000000..5736a6a7 --- /dev/null +++ b/common/kv/interface.go @@ -0,0 +1,39 @@ +package kv + +import kvv1 "github.com/spiral/roadrunner/v2/proto/kv/v1beta" + +// Storage represents single abstract storage. +type Storage interface { + // Has checks if value exists. + Has(keys ...string) (map[string]bool, error) + + // Get loads value content into a byte slice. + Get(key string) ([]byte, error) + + // MGet loads content of multiple values + // Returns the map with existing keys and associated values + MGet(keys ...string) (map[string][]byte, error) + + // Set used to upload item to KV with TTL + // 0 value in TTL means no TTL + Set(items ...*kvv1.Item) error + + // MExpire sets the TTL for multiply keys + MExpire(items ...*kvv1.Item) error + + // TTL return the rest time to live for provided keys + // Not supported for the memcached + TTL(keys ...string) (map[string]string, error) + + // Clear clean the entire storage + Clear() error + + // Delete one or multiple keys. + Delete(keys ...string) error +} + +// Constructor provides storage based on the config +type Constructor interface { + // KVConstruct provides Storage based on the config key + KVConstruct(key string) (Storage, error) +} |