Expose non-command features
Closed this issue · 2 comments
In a cluster setup it is still possible to use single-shard transactions. In order to do this you have to find the node holding the data.
You can find the node holding myKey the following way (using lettuce):
val conn: StatefulRedisClusterConnection[String, String] = ???
val slot = SlotHash.getSlot("myKey")
conn.getConnection(conn.getPartitions.getPartitionBySlot(slot).getNodeId)
getConnection
and getPartitions
are currently not available in redis4cats.
I wanted to add those methods to RedisCluster
or BaseRedis
but realized that, as of today, only RedisCommands
is.
But getConnection/partitions
are redis features and not redis commands, thus I doesn't seem right to add them to any *Commands
trait.
Any suggestion on how those features could be made available, it seems this will require some heavy refactoring ?
It seems to me that only exposing commands will be limiting, connection related features (partitions, lookup etc.) should also be exposed.