From 5b33eaec3678449c78211a46cda1057007b8a4bd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Mar 2021 08:42:20 +0300 Subject: [PATCH] [#265] reputation/grpc: Implement setters on generated messages Signed-off-by: Leonard Lyubich --- v2/reputation/grpc/service.go | 61 +++++++++++++++++++++++++++++++++++ v2/reputation/grpc/types.go | 15 +++++++++ 2 files changed, 76 insertions(+) create mode 100644 v2/reputation/grpc/service.go create mode 100644 v2/reputation/grpc/types.go diff --git a/v2/reputation/grpc/service.go b/v2/reputation/grpc/service.go new file mode 100644 index 00000000..80147df8 --- /dev/null +++ b/v2/reputation/grpc/service.go @@ -0,0 +1,61 @@ +package reputation + +import ( + session "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" +) + +// SetEpoch sets epoch in which the trust was assessed. +func (x *SendLocalTrustRequest_Body) SetEpoch(v uint64) { + if x != nil { + x.Epoch = v + } +} + +// SetTrusts sets list of normalized trust values. +func (x *SendLocalTrustRequest_Body) SetTrusts(v []*Trust) { + if x != nil { + x.Trusts = v + } +} + +// SetBody sets body of the request. +func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequest_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the request. +func (x *SendLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the request. +func (x *SendLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} + +// SetBody sets body of the response. +func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponse_Body) { + if x != nil { + x.Body = v + } +} + +// SetMetaHeader sets meta header of the response. +func (x *SendLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { + if x != nil { + x.MetaHeader = v + } +} + +// SetVerifyHeader sets verification header of the response. +func (x *SendLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { + if x != nil { + x.VerifyHeader = v + } +} diff --git a/v2/reputation/grpc/types.go b/v2/reputation/grpc/types.go new file mode 100644 index 00000000..84facdeb --- /dev/null +++ b/v2/reputation/grpc/types.go @@ -0,0 +1,15 @@ +package reputation + +// SetPeer sets trusted peer's ID. +func (x *Trust) SetPeer(v []byte) { + if x != nil { + x.Peer = v + } +} + +// SetValue sets trust value. +func (x *Trust) SetValue(v float64) { + if x != nil { + x.Value = v + } +}