support mset in cluster

This commit is contained in:
finley
2025-03-12 08:25:41 +08:00
parent 43dc28d335
commit 360de97479
9 changed files with 137 additions and 15 deletions

View File

@@ -52,15 +52,23 @@ func GetPartitionKey(key string) string {
return key[beg+1 : end]
}
func GetSlot(key string) uint32 {
func defaultGetSlotImpl(cluster *Cluster, key string) uint32 {
partitionKey := GetPartitionKey(key)
return crc32.ChecksumIEEE([]byte(partitionKey)) % uint32(SlotCount)
}
func (cluster *Cluster) GetSlot(key string) uint32 {
return cluster.getSlotImpl(key)
}
func defaultPickNodeImpl(cluster *Cluster, slotID uint32) string {
return cluster.raftNode.FSM.PickNode(slotID)
}
// pickNode returns the node id hosting the given slot.
// If the slot is migrating, return the node which is exporting the slot
func (cluster *Cluster) PickNode(slotID uint32) string {
return cluster.raftNode.FSM.PickNode(slotID)
return cluster.pickNodeImpl(slotID)
}
// format: raft.committedindex