[VOL-5359] Add redis option as KVStore
Change-Id: I5c2c837162685e45a50f8a4bef73bcf723a11f48
Signed-off-by: Abhay Kumar <abhayk@radisys.com>
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index 209247c..abd3617 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -25,10 +25,10 @@
// Open OLT default constants
const (
- EtcdStoreName = "etcd"
+ KVStoreName = "etcd"
defaultInstanceid = "openOlt001"
defaultKafkaclusteraddress = "127.0.0.1:9092"
- defaultKvstoretype = EtcdStoreName
+ defaultKvstoretype = KVStoreName
defaultKvstoretimeout = 5 * time.Second
defaultRPCTimeout = 10 * time.Second
defaultPerRPCRetryTimeout = 2 * time.Second
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index e46999c..48eff8d 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -244,6 +244,10 @@
switch storeType {
case "etcd":
return kvstore.NewEtcdClient(ctx, address, timeout, log.FatalLevel)
+ case "redis":
+ return kvstore.NewRedisClient(address, timeout, false)
+ case "redis-sentinel":
+ return kvstore.NewRedisClient(address, timeout, true)
}
return nil, errors.New("unsupported-kv-store")
}
diff --git a/internal/pkg/resourcemanager/resourcemanager.go b/internal/pkg/resourcemanager/resourcemanager.go
index f51737f..3fde9e0 100755
--- a/internal/pkg/resourcemanager/resourcemanager.go
+++ b/internal/pkg/resourcemanager/resourcemanager.go
@@ -173,6 +173,10 @@
switch storeType {
case "etcd":
return kvstore.NewEtcdClient(ctx, address, timeout, log.FatalLevel)
+ case "redis":
+ return kvstore.NewRedisClient(address, timeout, false)
+ case "redis-sentinel":
+ return kvstore.NewRedisClient(address, timeout, true)
}
return nil, errors.New("unsupported-kv-store")
}