diff --git a/pkg/services/control/convert.go b/pkg/services/control/convert.go index ea3c9e94b..ee344632e 100644 --- a/pkg/services/control/convert.go +++ b/pkg/services/control/convert.go @@ -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 +} diff --git a/pkg/services/control/rpc.go b/pkg/services/control/rpc.go index 1fda70bf0..dd8609823 100644 --- a/pkg/services/control/rpc.go +++ b/pkg/services/control/rpc.go @@ -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 +}