mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-16 05:40:49 +08:00
support mset in cluster
This commit is contained in:
@@ -22,6 +22,11 @@ type Cluster struct {
|
||||
slotsManager *slotsManager
|
||||
rebalanceManger *rebalanceManager
|
||||
transactions *TransactionManager
|
||||
|
||||
// allow inject route implementation
|
||||
getSlotImpl func(key string) uint32
|
||||
pickNodeImpl func(slotID uint32) string
|
||||
id_ string // for tests only
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -32,6 +37,9 @@ type Config struct {
|
||||
}
|
||||
|
||||
func (c *Cluster) SelfID() string {
|
||||
if c.raftNode == nil {
|
||||
return c.id_
|
||||
}
|
||||
return c.raftNode.Cfg.ID()
|
||||
}
|
||||
|
||||
@@ -130,6 +138,12 @@ func NewCluster(cfg *Config) (*Cluster, error) {
|
||||
slotsManager: newSlotsManager(),
|
||||
transactions: newTransactionManager(),
|
||||
}
|
||||
cluster.pickNodeImpl = func(slotID uint32) string {
|
||||
return defaultPickNodeImpl(cluster, slotID)
|
||||
}
|
||||
cluster.getSlotImpl = func(key string) uint32 {
|
||||
return defaultGetSlotImpl(cluster, key)
|
||||
}
|
||||
cluster.injectInsertCallback()
|
||||
cluster.injectDeleteCallback()
|
||||
return cluster, nil
|
||||
|
Reference in New Issue
Block a user