[#1635] control: Add method to search shards by object

Added method `ListShardsForObject` to ControlService and to
StorageEngine. It returns information about shards storing
object on the node.

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2025-02-04 21:21:31 +03:00
parent 6260d703ce
commit 9e31cb249f
7 changed files with 919 additions and 0 deletions

View file

@ -32,6 +32,7 @@ const (
rpcListTargetsLocalOverrides = "ListTargetsLocalOverrides"
rpcDetachShards = "DetachShards"
rpcStartShardRebuild = "StartShardRebuild"
rpcListShardsForObject = "ListShardsForObject"
)
// HealthCheck executes ControlService.HealthCheck RPC.
@ -364,3 +365,22 @@ func StartShardRebuild(cli *client.Client, req *StartShardRebuildRequest, opts .
return wResp.message, nil
}
// ListShardsForObject executes ControlService.ListShardsForObject RPC.
func ListShardsForObject(
cli *client.Client,
req *ListShardsForObjectRequest,
opts ...client.CallOption,
) (*ListShardsForObjectResponse, error) {
wResp := newResponseWrapper[ListShardsForObjectResponse]()
wReq := &requestWrapper{
m: req,
}
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcListShardsForObject), wReq, wResp, opts...)
if err != nil {
return nil, err
}
return wResp.message, nil
}