2021-03-15 11:04:13 +00:00
|
|
|
package control
|
|
|
|
|
|
|
|
import (
|
2021-11-06 11:13:04 +00:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc"
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
|
2021-03-15 11:04:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type requestWrapper struct {
|
|
|
|
message.Message
|
|
|
|
m grpc.Message
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *requestWrapper) ToGRPCMessage() grpc.Message {
|
|
|
|
return w.m
|
|
|
|
}
|
|
|
|
|
|
|
|
type healthCheckResponseWrapper struct {
|
|
|
|
m *HealthCheckResponse
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *healthCheckResponseWrapper) ToGRPCMessage() grpc.Message {
|
|
|
|
return w.m
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *healthCheckResponseWrapper) FromGRPCMessage(m grpc.Message) error {
|
|
|
|
var ok bool
|
|
|
|
|
|
|
|
w.m, ok = m.(*HealthCheckResponse)
|
|
|
|
if !ok {
|
|
|
|
return message.NewUnexpectedMessageType(m, w.m)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type netmapSnapshotResponseWrapper struct {
|
|
|
|
message.Message
|
|
|
|
m *NetmapSnapshotResponse
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *netmapSnapshotResponseWrapper) ToGRPCMessage() grpc.Message {
|
|
|
|
return w.m
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *netmapSnapshotResponseWrapper) FromGRPCMessage(m grpc.Message) error {
|
|
|
|
var ok bool
|
|
|
|
|
|
|
|
w.m, ok = m.(*NetmapSnapshotResponse)
|
|
|
|
if !ok {
|
|
|
|
return message.NewUnexpectedMessageType(m, w.m)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type setNetmapStatusResponseWrapper struct {
|
|
|
|
message.Message
|
|
|
|
m *SetNetmapStatusResponse
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *setNetmapStatusResponseWrapper) ToGRPCMessage() grpc.Message {
|
|
|
|
return w.m
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *setNetmapStatusResponseWrapper) FromGRPCMessage(m grpc.Message) error {
|
|
|
|
var ok bool
|
|
|
|
|
|
|
|
w.m, ok = m.(*SetNetmapStatusResponse)
|
|
|
|
if !ok {
|
|
|
|
return message.NewUnexpectedMessageType(m, w.m)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type dropObjectsResponseWrapper struct {
|
|
|
|
message.Message
|
|
|
|
m *DropObjectsResponse
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *dropObjectsResponseWrapper) ToGRPCMessage() grpc.Message {
|
|
|
|
return w.m
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *dropObjectsResponseWrapper) FromGRPCMessage(m grpc.Message) error {
|
|
|
|
var ok bool
|
|
|
|
|
|
|
|
w.m, ok = m.(*DropObjectsResponse)
|
|
|
|
if !ok {
|
|
|
|
return message.NewUnexpectedMessageType(m, w.m)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
2021-12-17 15:23:46 +00:00
|
|
|
|
2021-12-29 15:12:40 +00:00
|
|
|
type listShardsResponseWrapper struct {
|
2021-12-17 15:23:46 +00:00
|
|
|
m *ListShardsResponse
|
|
|
|
}
|
|
|
|
|
2021-12-29 15:12:40 +00:00
|
|
|
func (w *listShardsResponseWrapper) ToGRPCMessage() grpc.Message {
|
2021-12-17 15:23:46 +00:00
|
|
|
return w.m
|
|
|
|
}
|
|
|
|
|
2021-12-29 15:12:40 +00:00
|
|
|
func (w *listShardsResponseWrapper) FromGRPCMessage(m grpc.Message) error {
|
2021-12-17 15:23:46 +00:00
|
|
|
var ok bool
|
|
|
|
|
|
|
|
w.m, ok = m.(*ListShardsResponse)
|
|
|
|
if !ok {
|
|
|
|
return message.NewUnexpectedMessageType(m, w.m)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
2021-12-27 16:12:23 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|