summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-09 14:16:20 +0300
committerValery Piashchynski <[email protected]>2021-06-09 14:16:20 +0300
commit05e7925fbecb3e9f41f1a07fa459046ad0b16fc7 (patch)
treee4fc512aae21136d897832591cf25ccbb176e9af
parent4e059c8316189754c1edb876dcb8e6910b902bbb (diff)
- Slightly improve rpc methods errors
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r--plugins/kv/rpc.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/kv/rpc.go b/plugins/kv/rpc.go
index a9efe0c4..557d3ee1 100644
--- a/plugins/kv/rpc.go
+++ b/plugins/kv/rpc.go
@@ -16,11 +16,11 @@ type rpc struct {
log logger.Logger
}
-// Has accept []*payload.Payload proto payload with Storage and Item
+// Has accept []*kvv1.Payload proto payload with Storage and Item
func (r *rpc) Has(in *kvv1.Payload, res *map[string]bool) error {
const op = errors.Op("rpc_has")
- if in.Storage == "" {
+ if in.GetStorage() == "" {
return errors.E(op, errors.Str("no storage provided"))
}
@@ -30,10 +30,10 @@ func (r *rpc) Has(in *kvv1.Payload, res *map[string]bool) error {
keys = append(keys, in.Items[i].Key)
}
- if st, ok := r.storages[in.Storage]; ok {
+ if st, ok := r.storages[in.GetStorage()]; ok {
ret, err := st.Has(keys...)
if err != nil {
- return err
+ return errors.E(op, err)
}
// update the value in the pointer
@@ -52,7 +52,7 @@ func (r *rpc) Set(in *kvv1.Payload, ok *bool) error {
if st, exists := r.storages[in.GetStorage()]; exists {
err := st.Set(in.GetItems()...)
if err != nil {
- return err
+ return errors.E(op, err)
}
// save the result
@@ -77,7 +77,7 @@ func (r *rpc) MGet(in *kvv1.Payload, res *map[string]interface{}) error {
if st, exists := r.storages[in.GetStorage()]; exists {
ret, err := st.MGet(keys...)
if err != nil {
- return err
+ return errors.E(op, err)
}
// save the result
@@ -119,7 +119,7 @@ func (r *rpc) TTL(in *kvv1.Payload, res *map[string]interface{}) error {
if st, exists := r.storages[in.GetStorage()]; exists {
ret, err := st.TTL(keys...)
if err != nil {
- return err
+ return errors.E(op, err)
}
// save the result