Skip to content

Commit

Permalink
rpadmin: add TriggerBalancer method
Browse files Browse the repository at this point in the history
Wrapper of the existing
POST /v1/partitions/rebalance
endpoint
  • Loading branch information
daisukebe committed Aug 14, 2024
1 parent a0e2fec commit aa3b205
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rpadmin/api_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,8 @@ func (a *AdminAPI) TransferLeadership(ctx context.Context, ns, topic string, par
path := fmt.Sprintf("/v1/partitions/%s/%s/%d/transfer_leadership?target=%s", ns, topic, partition, target)
return a.sendOne(ctx, http.MethodPost, path, nil, nil, false)
}

// Trigger on-demand balancer.
func (a *AdminAPI) TriggerBalancer(ctx context.Context) error {
return a.sendToLeader(ctx, http.MethodPost, "/v1/partitions/rebalance", nil, nil)
}

0 comments on commit aa3b205

Please sign in to comment.