frostfs-node/pkg/services/control/ir/convert.go

35 lines
595 B
Go
Raw Normal View History

package control
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
type requestWrapper struct {
message.Message
m grpc.Message
}
func (w *requestWrapper) ToGRPCMessage() grpc.Message {
return w.m
}
type responseWrapper[M grpc.Message] struct {
m M
}
func (w *responseWrapper[M]) ToGRPCMessage() grpc.Message {
return w.m
}
func (w *responseWrapper[M]) FromGRPCMessage(m grpc.Message) error {
var ok bool
w.m, ok = m.(M)
if !ok {
return message.NewUnexpectedMessageType(m, w.m)
}
return nil
}