forked from TrueCloudLab/frostfs-node
[#1059] control: Add SetShardMode
RPC wrappers
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
25665cb0fd
commit
29c69f37eb
2 changed files with 41 additions and 0 deletions
|
@ -111,3 +111,22 @@ func (w *listShardsRequestWrapper) FromGRPCMessage(m grpc.Message) error {
|
||||||
|
|
||||||
return nil
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ const (
|
||||||
rpcSetNetmapStatus = "SetNetmapStatus"
|
rpcSetNetmapStatus = "SetNetmapStatus"
|
||||||
rpcDropObjects = "DropObjects"
|
rpcDropObjects = "DropObjects"
|
||||||
rpcListShards = "ListShards"
|
rpcListShards = "ListShards"
|
||||||
|
rpcSetShardMode = "SetShardMode"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HealthCheck executes ControlService.HealthCheck RPC.
|
// HealthCheck executes ControlService.HealthCheck RPC.
|
||||||
|
@ -122,3 +123,24 @@ func ListShards(
|
||||||
|
|
||||||
return wResp.m, nil
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue