[#1059] control: Add SetShardMode RPC wrappers

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-12-27 19:12:23 +03:00 committed by Alex Vanin
parent 25665cb0fd
commit 29c69f37eb
2 changed files with 41 additions and 0 deletions

View file

@ -111,3 +111,22 @@ func (w *listShardsRequestWrapper) FromGRPCMessage(m grpc.Message) error {
return nil
}
type setShardModeResponseWrapper struct {
m *SetShardModeResponse
}
func (w *setShardModeResponseWrapper) ToGRPCMessage() grpc.Message {
return w.m
}
func (w *setShardModeResponseWrapper) FromGRPCMessage(m grpc.Message) error {
var ok bool
w.m, ok = m.(*SetShardModeResponse)
if !ok {
return message.NewUnexpectedMessageType(m, w.m)
}
return nil
}

View file

@ -13,6 +13,7 @@ const (
rpcSetNetmapStatus = "SetNetmapStatus"
rpcDropObjects = "DropObjects"
rpcListShards = "ListShards"
rpcSetShardMode = "SetShardMode"
)
// HealthCheck executes ControlService.HealthCheck RPC.
@ -122,3 +123,24 @@ func ListShards(
return wResp.m, nil
}
// SetShardMode executes ControlService.SetShardMode RPC.
func SetShardMode(
cli *client.Client,
req *SetShardModeRequest,
opts ...client.CallOption,
) (*SetShardModeResponse, error) {
wResp := &setShardModeResponseWrapper{
m: new(SetShardModeResponse),
}
wReq := &requestWrapper{
m: req,
}
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSetShardMode), wReq, wResp, opts...)
if err != nil {
return nil, err
}
return wResp.m, nil
}