MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / SetSlot

Method SetSlot

store/cluster.go:236–251  ·  view source on GitHub ↗
(ctx context.Context, slot int, targetNodeID string)

Source from the content-addressed store, hash-verified

234}
235
236func (cluster *Cluster) SetSlot(ctx context.Context, slot int, targetNodeID string) error {
237 version := cluster.Version.Add(1)
238 for i := 0; i < len(cluster.Shards); i++ {
239 for _, node := range cluster.Shards[i].Nodes {
240 clusterNode, ok := node.(*ClusterNode)
241 if !ok {
242 continue
243 }
244 err := clusterNode.GetClient().Do(ctx, "CLUSTERX", "SETSLOT", slot, "NODE", targetNodeID, version).Err()
245 if err != nil {
246 return err
247 }
248 }
249 }
250 return nil
251}
252
253// ParseCluster will parse the cluster string into cluster topology.
254func ParseCluster(clusterStr string) (*Cluster, error) {

Callers

nothing calls this directly

Calls 1

GetClientMethod · 0.80

Tested by

no test coverage detected