Type for cluster and non-cluster mode.
Closed this issue · 2 comments
Bysmyyr commented
Hi,
I am using radix(v4) so that I need to use noncluster mode for local and ci and cluster mode in production. I did not find any common interface for ClusterConfig{}.New() and PoolConfig{}.New() results. I solved the issue with custom interface(below) but that does not feel right, should it be in the library, or did I miss something?
type RadixClient interface {
Do(context.Context, radix.Action) error
}
mediocregopher commented
Hi @Bysmyyr , I believe MultiClient is what you're looking for. Cluster will implement that directly, and you can convert a Pool to a MultiClient by passing it to NewMultiClient, like so:
multiClient := radix.NewMultiClient(radix.ReplicaSet{
Primary: pool,
})
Hope that answers your question!
Bysmyyr commented
Yes, thank you @mediocregopher , this it was.