aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/infra
diff options
context:
space:
mode:
Diffstat (limited to 'src/orchestrator/pkg/infra')
-rw-r--r--src/orchestrator/pkg/infra/contextdb/contextdb.go2
-rw-r--r--src/orchestrator/pkg/infra/contextdb/etcd.go15
2 files changed, 16 insertions, 1 deletions
diff --git a/src/orchestrator/pkg/infra/contextdb/contextdb.go b/src/orchestrator/pkg/infra/contextdb/contextdb.go
index d18af227..58832a19 100644
--- a/src/orchestrator/pkg/infra/contextdb/contextdb.go
+++ b/src/orchestrator/pkg/infra/contextdb/contextdb.go
@@ -29,6 +29,8 @@ type ContextDb interface {
Put(key string, value interface{}) error
// Delete k,v
Delete(key string) error
+ // Delete all keys in heirarchy
+ DeleteAll(key string) error
// Gets Json Struct from db
Get(key string, value interface{}) error
// Returns all keys with a prefix
diff --git a/src/orchestrator/pkg/infra/contextdb/etcd.go b/src/orchestrator/pkg/infra/contextdb/etcd.go
index a1922d3b..44f8ab48 100644
--- a/src/orchestrator/pkg/infra/contextdb/etcd.go
+++ b/src/orchestrator/pkg/infra/contextdb/etcd.go
@@ -156,13 +156,26 @@ func (e *EtcdClient) GetAllKeys(key string) ([]string, error) {
return keys, nil
}
+// DeleteAll keys from Etcd DB
+func (e *EtcdClient) DeleteAll(key string) error {
+ cli := getEtcd(e)
+ if cli == nil {
+ return pkgerrors.Errorf("Etcd Client not initialized")
+ }
+ _, err := cli.Delete(context.Background(), key, clientv3.WithPrefix())
+ if err != nil {
+ return pkgerrors.Errorf("Delete failed etcd entry: %s", err.Error())
+ }
+ return nil
+}
+
// Delete values from Etcd DB
func (e *EtcdClient) Delete(key string) error {
cli := getEtcd(e)
if cli == nil {
return pkgerrors.Errorf("Etcd Client not initialized")
}
- _, err := cli.Delete(context.Background(), key, clientv3.WithPrefix())
+ _, err := cli.Delete(context.Background(), key)
if err != nil {
return pkgerrors.Errorf("Delete failed etcd entry: %s", err.Error())
}