From c55a9fa9bd9df3258c9d4414240998b7bec5c34c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 17 Aug 2020 12:34:49 +0300 Subject: [PATCH] v2/service: Gather converters in one file Signed-off-by: Leonard Lyubich --- v2/service/convert.go | 26 ++++++++++++++++++++++++++ v2/service/service.go | 30 ------------------------------ 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/v2/service/convert.go b/v2/service/convert.go index bf2c3a2..2ced953 100644 --- a/v2/service/convert.go +++ b/v2/service/convert.go @@ -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 +} diff --git a/v2/service/service.go b/v2/service/service.go index 39557ee..1a1e0a7 100644 --- a/v2/service/service.go +++ b/v2/service/service.go @@ -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 -}