frostfs-node/pkg/services/control/convert.go
Airat Arifullin 9b13a18aac [#1479] go.mod: Bump frostfs-sdk-go version
* 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>
2024-11-08 10:43:19 +03:00

39 lines
749 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[T grpc.Message] struct {
message *T
}
func newResponseWrapper[T grpc.Message]() *responseWrapper[T] {
return &responseWrapper[T]{
message: new(T),
}
}
func (w *responseWrapper[T]) ToGRPCMessage() grpc.Message {
return w.message
}
func (w *responseWrapper[T]) FromGRPCMessage(m grpc.Message) error {
response, ok := m.(*T)
if !ok {
return message.NewUnexpectedMessageType(m, w.message)
}
w.message = response
return nil
}