[VOL-3860] redis client support in voltha-lib-go
redis client support has been added in this patch. There are two
types client `redis` and `redis-sentinel` to connect a redis instance.
redis-sentinel is required to be able to find the master redis
instance from a redis-sentinel process. See redis-sentinel usage
https://redis.io/topics/sentinel and
https://pkg.go.dev/github.com/go-redis/redis/v8#NewFailoverClient
for more information. If there is no need to have any failover
mechanism then the redis client type is the option to choose.
Change-Id: I997ed92115a9d565df632c6dd8184b9bab77b991
diff --git a/pkg/techprofile/tech_profile.go b/pkg/techprofile/tech_profile.go
index c9bd510..6d68f5a 100644
--- a/pkg/techprofile/tech_profile.go
+++ b/pkg/techprofile/tech_profile.go
@@ -1226,7 +1226,12 @@
switch storeType {
case "etcd":
return kvstore.NewEtcdClient(ctx, address, timeout, log.WarnLevel)
+ case "redis":
+ return kvstore.NewRedisClient(address, timeout, false)
+ case "redis-sentinel":
+ return kvstore.NewRedisClient(address, timeout, true)
}
+
return nil, errors.New("unsupported-kv-store")
}