summaryrefslogtreecommitdiff
path: root/plugins/kv/rpc.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kv/rpc.go')
-rw-r--r--plugins/kv/rpc.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/kv/rpc.go b/plugins/kv/rpc.go
index af763600..3f7ba97c 100644
--- a/plugins/kv/rpc.go
+++ b/plugins/kv/rpc.go
@@ -161,3 +161,19 @@ func (r *rpc) Delete(in *kvv1.Request, _ *kvv1.Response) error {
return errors.E(op, errors.Errorf("no such storage: %s", in.GetStorage()))
}
+
+// Clear clean the storage
+func (r *rpc) Clear(in *kvv1.Request, _ *kvv1.Response) error {
+ const op = errors.Op("rcp_delete")
+
+ if st, exists := r.storages[in.GetStorage()]; exists {
+ err := st.Clear()
+ if err != nil {
+ return errors.E(op, err)
+ }
+
+ return nil
+ }
+
+ return errors.E(op, errors.Errorf("no such storage: %s", in.GetStorage()))
+}