v2/service: Gather converters in one file

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-08-17 12:34:49 +03:00 committed by Stanislav Bogatyrev
parent 01581443a3
commit c55a9fa9bd
2 changed files with 26 additions and 30 deletions

View file

@ -199,3 +199,29 @@ func RequestMetaHeaderFromGRPCMessage(m *service.RequestMetaHeader) *RequestMeta
return r
}
func SignatureToGRPCMessage(s *Signature) *service.Signature {
if s == nil {
return nil
}
m := new(service.Signature)
m.SetKey(s.GetKey())
m.SetSign(s.GetSign())
return m
}
func SignatureFromGRPCMessage(m *service.Signature) *Signature {
if m == nil {
return nil
}
s := new(Signature)
s.SetKey(m.GetKey())
s.SetSign(m.GetSign())
return s
}

View file

@ -1,9 +1,5 @@
package service
import (
service "github.com/nspcc-dev/neofs-api-go/v2/service/grpc"
)
type Signature struct {
key, sign []byte
}
@ -315,29 +311,3 @@ func (r *RequestMetaHeader) StableSize() int {
// TODO: do not use hack
return RequestMetaHeaderToGRPCMessage(r).Size()
}
func SignatureToGRPCMessage(s *Signature) *service.Signature {
if s == nil {
return nil
}
m := new(service.Signature)
m.SetKey(s.GetKey())
m.SetSign(s.GetSign())
return m
}
func SignatureFromGRPCMessage(m *service.Signature) *Signature {
if m == nil {
return nil
}
s := new(Signature)
s.SetKey(m.GetKey())
s.SetSign(m.GetSign())
return s
}