Airat Arifullin
9b13a18aac
* Update version within go.mod; * Fix deprecated frostfs-api-go/v2 package and use frostfs-sdk-go/api instead. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
34 lines
597 B
Go
34 lines
597 B
Go
package control
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/grpc"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/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
|
|
}
|