forked from TrueCloudLab/frostfs-node
34 lines
595 B
Go
34 lines
595 B
Go
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
|
|
}
|