| 132 | } |
| 133 | |
| 134 | func (cluster *Cluster) PromoteNewMaster(ctx context.Context, |
| 135 | shardIdx int, masterNodeID, preferredNodeID string, |
| 136 | ) (string, error) { |
| 137 | shard, err := cluster.GetShard(shardIdx) |
| 138 | if err != nil { |
| 139 | return "", err |
| 140 | } |
| 141 | newMasterNodeID, err := shard.promoteNewMaster(ctx, masterNodeID, preferredNodeID) |
| 142 | if err != nil { |
| 143 | return "", err |
| 144 | } |
| 145 | cluster.Shards[shardIdx] = shard |
| 146 | return newMasterNodeID, nil |
| 147 | } |
| 148 | |
| 149 | func (cluster *Cluster) SyncToNodes(ctx context.Context) error { |
| 150 | for i := 0; i < len(cluster.Shards); i++ { |