From 099347d3bcc9b33b7e59798779bcf58e85047a89 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 7 May 2021 12:34:24 +0300 Subject: [PATCH] Synchronize namings with NeoFS API v2.6.0 Signed-off-by: Alex Vanin --- pkg/client/reputation.go | 64 ++++++------ pkg/reputation/peer.go | 10 +- v2/reputation/convert.go | 164 +++++++++++++++---------------- v2/reputation/grpc/service.go | 34 +++---- v2/reputation/grpc/service.pb.go | Bin 40249 -> 41817 bytes v2/reputation/grpc/types.go | 6 +- v2/reputation/grpc/types.pb.go | Bin 17780 -> 17867 bytes v2/reputation/marshal.go | 68 ++++++------- v2/reputation/message_test.go | 20 ++-- v2/reputation/test/generate.go | 42 ++++---- v2/reputation/types.go | 90 ++++++++--------- v2/rpc/reputation.go | 28 +++--- v2/signature/sign.go | 8 +- 13 files changed, 269 insertions(+), 265 deletions(-) diff --git a/pkg/client/reputation.go b/pkg/client/reputation.go index a096efb..253e4df 100644 --- a/pkg/client/reputation.go +++ b/pkg/client/reputation.go @@ -13,45 +13,45 @@ import ( // Reputation contains methods for working with Reputation system values. type Reputation interface { - // SendLocalTrust sends local trust values of local peer. - SendLocalTrust(context.Context, SendLocalTrustPrm, ...CallOption) (*SendLocalTrustRes, error) + // AnnounceLocalTrust announces local trust values of local peer. + AnnounceLocalTrust(context.Context, AnnounceLocalTrustPrm, ...CallOption) (*AnnounceLocalTrustRes, error) - // SendIntermediateTrust sends the intermediate result of the iterative algorithm for calculating + // AnnounceIntermediateTrust announces the intermediate result of the iterative algorithm for calculating // the global reputation of the node. - SendIntermediateTrust(context.Context, SendIntermediateTrustPrm, ...CallOption) (*SendIntermediateTrustRes, error) + AnnounceIntermediateTrust(context.Context, AnnounceIntermediateTrustPrm, ...CallOption) (*AnnounceIntermediateTrustRes, error) } -// SendLocalTrustPrm groups parameters of SendLocalTrust operation. -type SendLocalTrustPrm struct { +// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation. +type AnnounceLocalTrustPrm struct { epoch uint64 trusts []*reputation.Trust } // Epoch returns epoch in which the trust was assessed. -func (x SendLocalTrustPrm) Epoch() uint64 { +func (x AnnounceLocalTrustPrm) Epoch() uint64 { return x.epoch } // SetEpoch sets epoch in which the trust was assessed. -func (x *SendLocalTrustPrm) SetEpoch(epoch uint64) { +func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) { x.epoch = epoch } // Trusts returns list of local trust values. -func (x SendLocalTrustPrm) Trusts() []*reputation.Trust { +func (x AnnounceLocalTrustPrm) Trusts() []*reputation.Trust { return x.trusts } // SetTrusts sets list of local trust values. -func (x *SendLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) { +func (x *AnnounceLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) { x.trusts = trusts } -// SendLocalTrustPrm groups results of SendLocalTrust operation. -type SendLocalTrustRes struct{} +// AnnounceLocalTrustRes groups results of AnnounceLocalTrust operation. +type AnnounceLocalTrustRes struct{} -func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, opts ...CallOption) (*SendLocalTrustRes, error) { +func (c *clientImpl) AnnounceLocalTrust(ctx context.Context, prm AnnounceLocalTrustPrm, opts ...CallOption) (*AnnounceLocalTrustRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -59,11 +59,11 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, opts[i](callOptions) } - reqBody := new(v2reputation.SendLocalTrustRequestBody) + reqBody := new(v2reputation.AnnounceLocalTrustRequestBody) reqBody.SetEpoch(prm.Epoch()) reqBody.SetTrusts(reputation.TrustsToV2(prm.Trusts())) - req := new(v2reputation.SendLocalTrustRequest) + req := new(v2reputation.AnnounceLocalTrustRequest) req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) @@ -72,7 +72,7 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, return nil, err } - resp, err := rpcapi.SendLocalTrust(c.Raw(), req, client.WithContext(ctx)) + resp, err := rpcapi.AnnounceLocalTrust(c.Raw(), req, client.WithContext(ctx)) if err != nil { return nil, err } @@ -82,11 +82,11 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm, return nil, errors.Wrap(err, "can't verify response message") } - return new(SendLocalTrustRes), nil + return new(AnnounceLocalTrustRes), nil } -// SendIntermediateTrustPrm groups parameters of SendIntermediateTrust operation. -type SendIntermediateTrustPrm struct { +// AnnounceIntermediateTrustPrm groups parameters of AnnounceIntermediateTrust operation. +type AnnounceIntermediateTrustPrm struct { epoch uint64 iter uint32 @@ -94,38 +94,38 @@ type SendIntermediateTrustPrm struct { trust *reputation.PeerToPeerTrust } -func (x *SendIntermediateTrustPrm) Epoch() uint64 { +func (x *AnnounceIntermediateTrustPrm) Epoch() uint64 { return x.epoch } -func (x *SendIntermediateTrustPrm) SetEpoch(epoch uint64) { +func (x *AnnounceIntermediateTrustPrm) SetEpoch(epoch uint64) { x.epoch = epoch } // Iteration returns sequence number of the iteration. -func (x SendIntermediateTrustPrm) Iteration() uint32 { +func (x AnnounceIntermediateTrustPrm) Iteration() uint32 { return x.iter } // SetIteration sets sequence number of the iteration. -func (x *SendIntermediateTrustPrm) SetIteration(iter uint32) { +func (x *AnnounceIntermediateTrustPrm) SetIteration(iter uint32) { x.iter = iter } // Trust returns current global trust value computed at the specified iteration. -func (x SendIntermediateTrustPrm) Trust() *reputation.PeerToPeerTrust { +func (x AnnounceIntermediateTrustPrm) Trust() *reputation.PeerToPeerTrust { return x.trust } // SetTrust sets current global trust value computed at the specified iteration. -func (x *SendIntermediateTrustPrm) SetTrust(trust *reputation.PeerToPeerTrust) { +func (x *AnnounceIntermediateTrustPrm) SetTrust(trust *reputation.PeerToPeerTrust) { x.trust = trust } -// SendIntermediateTrustRes groups results of SendIntermediateTrust operation. -type SendIntermediateTrustRes struct{} +// AnnounceIntermediateTrustRes groups results of AnnounceIntermediateTrust operation. +type AnnounceIntermediateTrustRes struct{} -func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermediateTrustPrm, opts ...CallOption) (*SendIntermediateTrustRes, error) { +func (c *clientImpl) AnnounceIntermediateTrust(ctx context.Context, prm AnnounceIntermediateTrustPrm, opts ...CallOption) (*AnnounceIntermediateTrustRes, error) { // apply all available options callOptions := c.defaultCallOptions() @@ -133,12 +133,12 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed opts[i](callOptions) } - reqBody := new(v2reputation.SendIntermediateResultRequestBody) + reqBody := new(v2reputation.AnnounceIntermediateResultRequestBody) reqBody.SetEpoch(prm.Epoch()) reqBody.SetIteration(prm.Iteration()) reqBody.SetTrust(prm.Trust().ToV2()) - req := new(v2reputation.SendIntermediateResultRequest) + req := new(v2reputation.AnnounceIntermediateResultRequest) req.SetBody(reqBody) req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions)) @@ -147,7 +147,7 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed return nil, err } - resp, err := rpcapi.SendIntermediateResult(c.Raw(), req, client.WithContext(ctx)) + resp, err := rpcapi.AnnounceIntermediateResult(c.Raw(), req, client.WithContext(ctx)) if err != nil { return nil, err } @@ -157,5 +157,5 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed return nil, errors.Wrap(err, "can't verify response message") } - return new(SendIntermediateTrustRes), nil + return new(AnnounceIntermediateTrustRes), nil } diff --git a/pkg/reputation/peer.go b/pkg/reputation/peer.go index 60d4ea3..f35b9ea 100644 --- a/pkg/reputation/peer.go +++ b/pkg/reputation/peer.go @@ -24,7 +24,7 @@ func PeerIDFromV2(id *reputation.PeerID) *PeerID { // SetPublicKey sets peer ID as a compressed public key. func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte) { (*reputation.PeerID)(x). - SetValue(v[:]) + SetPublicKey(v[:]) } // ToV2 converts PeerID to NeoFS API v2 reputation.PeerID message. @@ -35,8 +35,8 @@ func (x *PeerID) ToV2() *reputation.PeerID { // Equal returns true if identifiers are identical. func (x *PeerID) Equal(x2 *PeerID) bool { return bytes.Equal( - (*reputation.PeerID)(x).GetValue(), - (*reputation.PeerID)(x2).GetValue(), + (*reputation.PeerID)(x).GetPublicKey(), + (*reputation.PeerID)(x2).GetPublicKey(), ) } @@ -47,7 +47,7 @@ func (x *PeerID) Parse(s string) error { return err } - (*reputation.PeerID)(x).SetValue(data) + (*reputation.PeerID)(x).SetPublicKey(data) return nil } @@ -56,7 +56,7 @@ func (x *PeerID) Parse(s string) error { func (x *PeerID) String() string { return base58.Encode( (*reputation.PeerID)(x). - GetValue(), + GetPublicKey(), ) } diff --git a/v2/reputation/convert.go b/v2/reputation/convert.go index 2e31df9..0c49508 100644 --- a/v2/reputation/convert.go +++ b/v2/reputation/convert.go @@ -16,7 +16,7 @@ func (x *PeerID) ToGRPCMessage() grpc.Message { if x != nil { m = new(reputation.PeerID) - m.SetValue(x.val) + m.SetPublicKey(x.publicKey) } return m @@ -32,7 +32,7 @@ func (x *PeerID) FromGRPCMessage(m grpc.Message) error { return message.NewUnexpectedMessageType(m, v) } - x.val = v.GetValue() + x.publicKey = v.GetPublicKey() return nil } @@ -300,13 +300,13 @@ func (x *GlobalTrust) FromGRPCMessage(m grpc.Message) error { return err } -// ToGRPCMessage converts SendLocalTrustRequestBody to gRPC-generated -// reputation.SendLocalTrustRequest_Body message. -func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustRequest_Body +// ToGRPCMessage converts AnnounceLocalTrustRequestBody to gRPC-generated +// reputation.AnnounceLocalTrustRequest_Body message. +func (x *AnnounceLocalTrustRequestBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustRequest_Body if x != nil { - m = new(reputation.SendLocalTrustRequest_Body) + m = new(reputation.AnnounceLocalTrustRequest_Body) m.SetEpoch(x.epoch) m.SetTrusts(TrustsToGRPC(x.trusts)) @@ -315,12 +315,12 @@ func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message { return m } -// FromGRPCMessage tries to restore SendLocalTrustRequestBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustRequestBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustRequest_Body message. -func (x *SendLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustRequest_Body) +// a gRPC-generated reputation.AnnounceLocalTrustRequest_Body message. +func (x *AnnounceLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustRequest_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -337,27 +337,27 @@ func (x *SendLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error { return nil } -// ToGRPCMessage converts SendLocalTrustRequest to gRPC-generated -// reputation.SendLocalTrustRequest message. -func (x *SendLocalTrustRequest) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustRequest +// ToGRPCMessage converts AnnounceLocalTrustRequest to gRPC-generated +// reputation.AnnounceLocalTrustRequest message. +func (x *AnnounceLocalTrustRequest) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustRequest if x != nil { - m = new(reputation.SendLocalTrustRequest) + m = new(reputation.AnnounceLocalTrustRequest) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendLocalTrustRequest_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceLocalTrustRequest_Body)) x.RequestHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendLocalTrustRequest from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustRequest from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustRequest message. -func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustRequest) +// a gRPC-generated reputation.AnnounceLocalTrustRequest message. +func (x *AnnounceLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustRequest) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -369,7 +369,7 @@ func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendLocalTrustRequestBody) + x.body = new(AnnounceLocalTrustRequestBody) } err = x.body.FromGRPCMessage(body) @@ -381,24 +381,24 @@ func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error { return x.RequestHeaders.FromMessage(v) } -// ToGRPCMessage converts SendLocalTrustResponseBody to gRPC-generated -// reputation.SendLocalTrustResponse_Body message. -func (x *SendLocalTrustResponseBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustResponse_Body +// ToGRPCMessage converts AnnounceLocalTrustResponseBody to gRPC-generated +// reputation.AnnounceLocalTrustResponse_Body message. +func (x *AnnounceLocalTrustResponseBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustResponse_Body if x != nil { - m = new(reputation.SendLocalTrustResponse_Body) + m = new(reputation.AnnounceLocalTrustResponse_Body) } return m } -// FromGRPCMessage tries to restore SendLocalTrustResponseBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustResponseBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustResponse_Body message. -func (x *SendLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustResponse_Body) +// a gRPC-generated reputation.AnnounceLocalTrustResponse_Body message. +func (x *AnnounceLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustResponse_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -406,27 +406,27 @@ func (x *SendLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error { return nil } -// ToGRPCMessage converts SendLocalTrustResponse to gRPC-generated -// reputation.SendLocalTrustResponse message. -func (x *SendLocalTrustResponse) ToGRPCMessage() grpc.Message { - var m *reputation.SendLocalTrustResponse +// ToGRPCMessage converts AnnounceLocalTrustResponse to gRPC-generated +// reputation.AnnounceLocalTrustResponse message. +func (x *AnnounceLocalTrustResponse) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceLocalTrustResponse if x != nil { - m = new(reputation.SendLocalTrustResponse) + m = new(reputation.AnnounceLocalTrustResponse) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendLocalTrustResponse_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceLocalTrustResponse_Body)) x.ResponseHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendLocalTrustResponse from grpc.Message. +// FromGRPCMessage tries to restore AnnounceLocalTrustResponse from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendLocalTrustResponse message. -func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendLocalTrustResponse) +// a gRPC-generated reputation.AnnounceLocalTrustResponse message. +func (x *AnnounceLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceLocalTrustResponse) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -438,7 +438,7 @@ func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendLocalTrustResponseBody) + x.body = new(AnnounceLocalTrustResponseBody) } err = x.body.FromGRPCMessage(body) @@ -450,13 +450,13 @@ func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error { return x.ResponseHeaders.FromMessage(v) } -// ToGRPCMessage converts SendIntermediateResultRequestBody to gRPC-generated -// reputation.SendIntermediateResultRequest_Body message. -func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultRequest_Body +// ToGRPCMessage converts AnnounceIntermediateResultRequestBody to gRPC-generated +// reputation.AnnounceIntermediateResultRequest_Body message. +func (x *AnnounceIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultRequest_Body if x != nil { - m = new(reputation.SendIntermediateResultRequest_Body) + m = new(reputation.AnnounceIntermediateResultRequest_Body) m.SetEpoch(x.epoch) m.SetIteration(x.iter) @@ -466,12 +466,12 @@ func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message { return m } -// FromGRPCMessage tries to restore SendIntermediateResultRequestBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultRequestBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultRequest_Body message. -func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultRequest_Body) +// a gRPC-generated reputation.AnnounceIntermediateResultRequest_Body message. +func (x *AnnounceIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultRequest_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -496,27 +496,27 @@ func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) erro return nil } -// ToGRPCMessage converts SendIntermediateResultRequest to gRPC-generated -// reputation.SendIntermediateResultRequest message. -func (x *SendIntermediateResultRequest) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultRequest +// ToGRPCMessage converts AnnounceIntermediateResultRequest to gRPC-generated +// reputation.AnnounceIntermediateResultRequest message. +func (x *AnnounceIntermediateResultRequest) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultRequest if x != nil { - m = new(reputation.SendIntermediateResultRequest) + m = new(reputation.AnnounceIntermediateResultRequest) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendIntermediateResultRequest_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceIntermediateResultRequest_Body)) x.RequestHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendIntermediateResultRequest from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultRequest from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultRequest message. -func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultRequest) +// a gRPC-generated reputation.AnnounceIntermediateResultRequest message. +func (x *AnnounceIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultRequest) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -528,7 +528,7 @@ func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendIntermediateResultRequestBody) + x.body = new(AnnounceIntermediateResultRequestBody) } err = x.body.FromGRPCMessage(body) @@ -540,24 +540,24 @@ func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error { return x.RequestHeaders.FromMessage(v) } -// ToGRPCMessage converts SendIntermediateResultResponseBody to gRPC-generated -// reputation.SendIntermediateResultResponse_Body message. -func (x *SendIntermediateResultResponseBody) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultResponse_Body +// ToGRPCMessage converts AnnounceIntermediateResultResponseBody to gRPC-generated +// reputation.AnnounceIntermediateResultResponse_Body message. +func (x *AnnounceIntermediateResultResponseBody) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultResponse_Body if x != nil { - m = new(reputation.SendIntermediateResultResponse_Body) + m = new(reputation.AnnounceIntermediateResultResponse_Body) } return m } -// FromGRPCMessage tries to restore SendIntermediateResultResponseBody from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultResponseBody from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultResponse_Body message. -func (x *SendIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultResponse_Body) +// a gRPC-generated reputation.AnnounceIntermediateResultResponse_Body message. +func (x *AnnounceIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultResponse_Body) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -565,27 +565,27 @@ func (x *SendIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) err return nil } -// ToGRPCMessage converts SendIntermediateResultResponse to gRPC-generated -// reputation.SendIntermediateResultResponse message. -func (x *SendIntermediateResultResponse) ToGRPCMessage() grpc.Message { - var m *reputation.SendIntermediateResultResponse +// ToGRPCMessage converts AnnounceIntermediateResultResponse to gRPC-generated +// reputation.AnnounceIntermediateResultResponse message. +func (x *AnnounceIntermediateResultResponse) ToGRPCMessage() grpc.Message { + var m *reputation.AnnounceIntermediateResultResponse if x != nil { - m = new(reputation.SendIntermediateResultResponse) + m = new(reputation.AnnounceIntermediateResultResponse) - m.SetBody(x.body.ToGRPCMessage().(*reputation.SendIntermediateResultResponse_Body)) + m.SetBody(x.body.ToGRPCMessage().(*reputation.AnnounceIntermediateResultResponse_Body)) x.ResponseHeaders.ToMessage(m) } return m } -// FromGRPCMessage tries to restore SendIntermediateResultResponse from grpc.Message. +// FromGRPCMessage tries to restore AnnounceIntermediateResultResponse from grpc.Message. // // Returns message.ErrUnexpectedMessageType if m is not -// a gRPC-generated reputation.SendIntermediateResultResponse message. -func (x *SendIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*reputation.SendIntermediateResultResponse) +// a gRPC-generated reputation.AnnounceIntermediateResultResponse message. +func (x *AnnounceIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*reputation.AnnounceIntermediateResultResponse) if !ok { return message.NewUnexpectedMessageType(m, v) } @@ -597,7 +597,7 @@ func (x *SendIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error { x.body = nil } else { if x.body == nil { - x.body = new(SendIntermediateResultResponseBody) + x.body = new(AnnounceIntermediateResultResponseBody) } err = x.body.FromGRPCMessage(body) diff --git a/v2/reputation/grpc/service.go b/v2/reputation/grpc/service.go index 77878bd..b48a275 100644 --- a/v2/reputation/grpc/service.go +++ b/v2/reputation/grpc/service.go @@ -5,119 +5,119 @@ import ( ) // SetEpoch sets epoch in which the trust was assessed. -func (x *SendLocalTrustRequest_Body) SetEpoch(v uint64) { +func (x *AnnounceLocalTrustRequest_Body) SetEpoch(v uint64) { if x != nil { x.Epoch = v } } // SetTrusts sets list of normalized trust values. -func (x *SendLocalTrustRequest_Body) SetTrusts(v []*Trust) { +func (x *AnnounceLocalTrustRequest_Body) SetTrusts(v []*Trust) { if x != nil { x.Trusts = v } } // SetBody sets body of the request. -func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequest_Body) { +func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequest_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the request. -func (x *SendLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { +func (x *AnnounceLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (x *SendLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { +func (x *AnnounceLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if x != nil { x.VerifyHeader = v } } // SetBody sets body of the response. -func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponse_Body) { +func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponse_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the response. -func (x *SendLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { +func (x *AnnounceLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (x *SendLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { +func (x *AnnounceLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if x != nil { x.VerifyHeader = v } } // SetEpoch sets epoch in which the intermediate trust was assessed. -func (x *SendIntermediateResultRequest_Body) SetEpoch(v uint64) { +func (x *AnnounceIntermediateResultRequest_Body) SetEpoch(v uint64) { if x != nil { x.Epoch = v } } // SetIteration sets sequence number of the iteration. -func (x *SendIntermediateResultRequest_Body) SetIteration(v uint32) { +func (x *AnnounceIntermediateResultRequest_Body) SetIteration(v uint32) { if x != nil { x.Iteration = v } } // SetTrust sets current global trust value. -func (x *SendIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) { +func (x *AnnounceIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) { if x != nil { x.Trust = v } } // SetBody sets body of the request. -func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequest_Body) { +func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequest_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the request. -func (x *SendIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) { +func (x *AnnounceIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the request. -func (x *SendIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { +func (x *AnnounceIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) { if x != nil { x.VerifyHeader = v } } // SetBody sets body of the response. -func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponse_Body) { +func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponse_Body) { if x != nil { x.Body = v } } // SetMetaHeader sets meta header of the response. -func (x *SendIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) { +func (x *AnnounceIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) { if x != nil { x.MetaHeader = v } } // SetVerifyHeader sets verification header of the response. -func (x *SendIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { +func (x *AnnounceIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) { if x != nil { x.VerifyHeader = v } diff --git a/v2/reputation/grpc/service.pb.go b/v2/reputation/grpc/service.pb.go index 0f0edfaa8011e3b5dbaef15c470979d609ebbcad..79234d600d455db2c682c70ea2403531fc399a93 100644 GIT binary patch delta 6028 zcmbtYdr*|u6(0~`S)TG-7Fa$oBFbZTS(c{+mt{c=p`twHQ9hQBM_l&Xr?5s*qsID5 zg=36qX^crbV{0ceU8mO6u}!B<$LZA8=^t%6#+b~ct!;{SQahcd)!y?haPNl(gW-?m zp5Hy^+;h+Q-Sd6-yYzPOd+!EMzrU>5WVef6yH()qV!yE3&DlgNZ{s{JuiL{7+XqC~ z2=5sd?FCAY&mnMg+ORC-f?{6abCdknLyiSgWN$<~M5M%0;856asDQJg!Yl`_D$-!o-&37lRy)ppa2OA)<;xQU~j}OR!D;T=_6H*i|(7_=kntc z+z!$178YjWV&o6!o%)?oXPGRR;uBPx1-IbIS;IZA3|~9ORniPvVt+et2SgL{S1=ht z;QK3?j1a(oc?Fx1CQm%nugYPa9AJe6xEUWo0cVs7lGE2w0GH@U*d_;VBseM1m8ec# zj0AfVFV8FcO-bjNt?x}tf$)^L`Ds9)H06pMh*w+Wz_dCHt|^jbpnqCj!w>--ZBed~ zsX$wrTMjtVm&?guO3ILLAN@GeZ4a9fQUujQPogTH-TUK-keQ{1tC8QP4)xib|5(Ox zCM%g)d33rd>km}O%u0j$l?(w8kP!fZ%PYFU^3=!Fj2}&va{#qk;`@>fyOg_>$^mk+ zxtuX>?fg-l$j*qZ7W;jKkrdQtcTtxU*#}u613pNwKWUf16L@R&o;0bO@NT!@c8>^l z4`*?R)*;UB9qAKXpebsFzvpDH^oX4384_GvqafC9k@}IlfNLHSxb3{nD=5RYTBu%A zSV1b$&y8Sz>JvB~VQ#=Ck}hQ*cz3T&J!=-_5yr`=9`?t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U%X+5E(KflP|ULJm#Rl1al?>AX#pv|^W|&0-aA%sO8=n26ZOWQXxxqPSgsW^)n? zjj3W=O_#;9MMk=f+{s>&H40a9`4KY4t}NbjrA#KR_{)9D#&p^nGg~?fjTPl(Q3H$3 z2jG_L%OpFZvIm|1X6%&-hx2}lxu6r@{4z#$2}k`tEUOO8DPi7TYKlPDb-a+>_!4ko z-QR%f5>ZH|_@h_DkOO@34ucmJ7uIAO-pd|dx*H^@RO}{#Iwi>q-3rAC#!wP)^3nn; z9SVBkO=wsNMA1iu%gdBvM3I=56)$xs7HOSLvg=n{6KI!fnXZnWKpiJ2In*o(m4Ovn zk0ovMsuey^}FAKGTYgM-bLc&AuVrP?|1X_b^EW9SGa zF{W1V%9KjcA@5-79=uk!?QYq(;au1WTd0mHdilnKFvX1O#^!&5$fKT6#=D7InK7Ai<#bwU_ aIL_xk#>ISPg2G8%=t}Hiy<#?zs`(2MP!cr& diff --git a/v2/reputation/marshal.go b/v2/reputation/marshal.go index 2f08408..6c15062 100644 --- a/v2/reputation/marshal.go +++ b/v2/reputation/marshal.go @@ -8,7 +8,7 @@ import ( const ( _ = iota - peerIDValFNum + peerIDPubKeyFNum ) func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { @@ -20,7 +20,7 @@ func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, x.StableSize()) } - _, err := protoutil.BytesMarshal(peerIDValFNum, buf, x.val) + _, err := protoutil.BytesMarshal(peerIDPubKeyFNum, buf, x.publicKey) if err != nil { return nil, err } @@ -29,7 +29,7 @@ func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) { } func (x *PeerID) StableSize() (size int) { - size += protoutil.BytesSize(peerIDValFNum, x.val) + size += protoutil.BytesSize(peerIDPubKeyFNum, x.publicKey) return } @@ -212,11 +212,11 @@ func (x *GlobalTrust) Unmarshal(data []byte) error { const ( _ = iota - sendLocalTrustBodyEpochFNum - sendLocalTrustBodyTrustsFNum + announceLocalTrustBodyEpochFNum + announceLocalTrustBodyTrustsFNum ) -func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { if x == nil { return []byte{}, nil } @@ -230,7 +230,7 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { err error ) - n, err = protoutil.UInt64Marshal(sendLocalTrustBodyEpochFNum, buf[offset:], x.epoch) + n, err = protoutil.UInt64Marshal(announceLocalTrustBodyEpochFNum, buf[offset:], x.epoch) if err != nil { return nil, err } @@ -238,7 +238,7 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { offset += n for i := range x.trusts { - n, err = protoutil.NestedStructureMarshal(sendLocalTrustBodyTrustsFNum, buf[offset:], x.trusts[i]) + n, err = protoutil.NestedStructureMarshal(announceLocalTrustBodyTrustsFNum, buf[offset:], x.trusts[i]) if err != nil { return nil, err } @@ -249,40 +249,40 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (x *SendLocalTrustRequestBody) StableSize() (size int) { - size += protoutil.UInt64Size(sendLocalTrustBodyEpochFNum, x.epoch) +func (x *AnnounceLocalTrustRequestBody) StableSize() (size int) { + size += protoutil.UInt64Size(announceLocalTrustBodyEpochFNum, x.epoch) for i := range x.trusts { - size += protoutil.NestedStructureSize(sendLocalTrustBodyTrustsFNum, x.trusts[i]) + size += protoutil.NestedStructureSize(announceLocalTrustBodyTrustsFNum, x.trusts[i]) } return } -func (x *SendLocalTrustRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendLocalTrustRequest_Body)) +func (x *AnnounceLocalTrustRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustRequest_Body)) } -func (x *SendLocalTrustResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceLocalTrustResponseBody) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (x *SendLocalTrustResponseBody) StableSize() int { +func (x *AnnounceLocalTrustResponseBody) StableSize() int { return 0 } -func (x *SendLocalTrustResponseBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendLocalTrustResponse_Body)) +func (x *AnnounceLocalTrustResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustResponse_Body)) } const ( _ = iota - sendInterResBodyEpochFNum - sendInterResBodyIterFNum - sendInterResBodyTrustFNum + announceInterResBodyEpochFNum + announceInterResBodyIterFNum + announceInterResBodyTrustFNum ) -func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) { if x == nil { return []byte{}, nil } @@ -296,21 +296,21 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e err error ) - n, err = protoutil.UInt64Marshal(sendInterResBodyEpochFNum, buf, x.epoch) + n, err = protoutil.UInt64Marshal(announceInterResBodyEpochFNum, buf, x.epoch) if err != nil { return nil, err } offset += n - n, err = protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf[offset:], x.iter) + n, err = protoutil.UInt32Marshal(announceInterResBodyIterFNum, buf[offset:], x.iter) if err != nil { return nil, err } offset += n - _, err = protoutil.NestedStructureMarshal(sendInterResBodyTrustFNum, buf[offset:], x.trust) + _, err = protoutil.NestedStructureMarshal(announceInterResBodyTrustFNum, buf[offset:], x.trust) if err != nil { return nil, err } @@ -318,26 +318,26 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e return buf, nil } -func (x *SendIntermediateResultRequestBody) StableSize() (size int) { - size += protoutil.UInt64Size(sendInterResBodyEpochFNum, x.epoch) - size += protoutil.UInt32Size(sendInterResBodyIterFNum, x.iter) - size += protoutil.NestedStructureSize(sendInterResBodyTrustFNum, x.trust) +func (x *AnnounceIntermediateResultRequestBody) StableSize() (size int) { + size += protoutil.UInt64Size(announceInterResBodyEpochFNum, x.epoch) + size += protoutil.UInt32Size(announceInterResBodyIterFNum, x.iter) + size += protoutil.NestedStructureSize(announceInterResBodyTrustFNum, x.trust) return } -func (x *SendIntermediateResultRequestBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendIntermediateResultRequest_Body)) +func (x *AnnounceIntermediateResultRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultRequest_Body)) } -func (x *SendIntermediateResultResponseBody) StableMarshal(buf []byte) ([]byte, error) { +func (x *AnnounceIntermediateResultResponseBody) StableMarshal(buf []byte) ([]byte, error) { return buf, nil } -func (x *SendIntermediateResultResponseBody) StableSize() int { +func (x *AnnounceIntermediateResultResponseBody) StableSize() int { return 0 } -func (x *SendIntermediateResultResponseBody) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(reputation.SendIntermediateResultResponse_Body)) +func (x *AnnounceIntermediateResultResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultResponse_Body)) } diff --git a/v2/reputation/message_test.go b/v2/reputation/message_test.go index 2d5899a..f09c636 100644 --- a/v2/reputation/message_test.go +++ b/v2/reputation/message_test.go @@ -11,18 +11,22 @@ import ( func TestMessageConvert(t *testing.T) { messagetest.TestRPCMessage(t, func(empty bool) message.Message { return reputationtest.GenerateTrust(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequestBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequest(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponseBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponse(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustRequestBody(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustRequest(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponseBody(empty) }, + func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponse(empty) }, func(empty bool) message.Message { - return reputationtest.GenerateSendIntermediateResultRequestBody(empty) + return reputationtest.GenerateAnnounceIntermediateResultRequestBody(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendIntermediateResultRequest(empty) }, func(empty bool) message.Message { - return reputationtest.GenerateSendIntermediateResultResponseBody(empty) + return reputationtest.GenerateAnnounceIntermediateResultRequest(empty) + }, + func(empty bool) message.Message { + return reputationtest.GenerateAnnounceIntermediateResultResponseBody(empty) + }, + func(empty bool) message.Message { + return reputationtest.GenerateAnnounceIntermediateResultResponse(empty) }, - func(empty bool) message.Message { return reputationtest.GenerateSendIntermediateResultResponse(empty) }, func(empty bool) message.Message { return reputationtest.GenerateGlobalTrustBody(empty) }, func(empty bool) message.Message { return reputationtest.GenerateGlobalTrust(empty) }, func(empty bool) message.Message { return reputationtest.GeneratePeerToPeerTrust(empty) }, diff --git a/v2/reputation/test/generate.go b/v2/reputation/test/generate.go index 8b2adc5..cd6bd0c 100644 --- a/v2/reputation/test/generate.go +++ b/v2/reputation/test/generate.go @@ -10,7 +10,7 @@ func GeneratePeerID(empty bool) *reputation.PeerID { m := new(reputation.PeerID) if !empty { - m.SetValue([]byte{1, 2, 3}) + m.SetPublicKey([]byte{1, 2, 3}) } return m @@ -67,8 +67,8 @@ func GenerateTrusts(empty bool) (res []*reputation.Trust) { return } -func GenerateSendLocalTrustRequestBody(empty bool) *reputation.SendLocalTrustRequestBody { - m := new(reputation.SendLocalTrustRequestBody) +func GenerateAnnounceLocalTrustRequestBody(empty bool) *reputation.AnnounceLocalTrustRequestBody { + m := new(reputation.AnnounceLocalTrustRequestBody) if !empty { m.SetEpoch(13) @@ -79,34 +79,34 @@ func GenerateSendLocalTrustRequestBody(empty bool) *reputation.SendLocalTrustReq return m } -func GenerateSendLocalTrustRequest(empty bool) *reputation.SendLocalTrustRequest { - m := new(reputation.SendLocalTrustRequest) +func GenerateAnnounceLocalTrustRequest(empty bool) *reputation.AnnounceLocalTrustRequest { + m := new(reputation.AnnounceLocalTrustRequest) - m.SetBody(GenerateSendLocalTrustRequestBody(empty)) + m.SetBody(GenerateAnnounceLocalTrustRequestBody(empty)) m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) return m } -func GenerateSendLocalTrustResponseBody(empty bool) *reputation.SendLocalTrustResponseBody { - m := new(reputation.SendLocalTrustResponseBody) +func GenerateAnnounceLocalTrustResponseBody(empty bool) *reputation.AnnounceLocalTrustResponseBody { + m := new(reputation.AnnounceLocalTrustResponseBody) return m } -func GenerateSendLocalTrustResponse(empty bool) *reputation.SendLocalTrustResponse { - m := new(reputation.SendLocalTrustResponse) +func GenerateAnnounceLocalTrustResponse(empty bool) *reputation.AnnounceLocalTrustResponse { + m := new(reputation.AnnounceLocalTrustResponse) - m.SetBody(GenerateSendLocalTrustResponseBody(empty)) + m.SetBody(GenerateAnnounceLocalTrustResponseBody(empty)) m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) return m } -func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendIntermediateResultRequestBody { - m := new(reputation.SendIntermediateResultRequestBody) +func GenerateAnnounceIntermediateResultRequestBody(empty bool) *reputation.AnnounceIntermediateResultRequestBody { + m := new(reputation.AnnounceIntermediateResultRequestBody) if !empty { m.SetEpoch(123) @@ -117,26 +117,26 @@ func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendInter return m } -func GenerateSendIntermediateResultRequest(empty bool) *reputation.SendIntermediateResultRequest { - m := new(reputation.SendIntermediateResultRequest) +func GenerateAnnounceIntermediateResultRequest(empty bool) *reputation.AnnounceIntermediateResultRequest { + m := new(reputation.AnnounceIntermediateResultRequest) - m.SetBody(GenerateSendIntermediateResultRequestBody(empty)) + m.SetBody(GenerateAnnounceIntermediateResultRequestBody(empty)) m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty)) return m } -func GenerateSendIntermediateResultResponseBody(empty bool) *reputation.SendIntermediateResultResponseBody { - m := new(reputation.SendIntermediateResultResponseBody) +func GenerateAnnounceIntermediateResultResponseBody(empty bool) *reputation.AnnounceIntermediateResultResponseBody { + m := new(reputation.AnnounceIntermediateResultResponseBody) return m } -func GenerateSendIntermediateResultResponse(empty bool) *reputation.SendIntermediateResultResponse { - m := new(reputation.SendIntermediateResultResponse) +func GenerateAnnounceIntermediateResultResponse(empty bool) *reputation.AnnounceIntermediateResultResponse { + m := new(reputation.AnnounceIntermediateResultResponse) - m.SetBody(GenerateSendIntermediateResultResponseBody(empty)) + m.SetBody(GenerateAnnounceIntermediateResultResponseBody(empty)) m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty)) m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty)) diff --git a/v2/reputation/types.go b/v2/reputation/types.go index b1bd707..4ce995d 100644 --- a/v2/reputation/types.go +++ b/v2/reputation/types.go @@ -8,22 +8,22 @@ import ( // PeerID represents reputation.PeerID message // from NeoFS API v2. type PeerID struct { - val []byte + publicKey []byte } -// GetValue returns peer's binary ID. -func (x *PeerID) GetValue() []byte { +// GetPublicKey returns peer's binary public key of ID. +func (x *PeerID) GetPublicKey() []byte { if x != nil { - return x.val + return x.publicKey } return nil } -// SetValue sets peer's binary ID. -func (x *PeerID) SetValue(v []byte) { +// SetPublicKey sets peer's binary public key of ID. +func (x *PeerID) SetPublicKey(v []byte) { if x != nil { - x.val = v + x.publicKey = v } } @@ -205,15 +205,15 @@ func (x *GlobalTrust) SetSignature(v *refs.Signature) { } } -// SendLocalTrustRequestBody is a structure of SendLocalTrust request body. -type SendLocalTrustRequestBody struct { +// AnnounceLocalTrustRequestBody is a structure of AnnounceLocalTrust request body. +type AnnounceLocalTrustRequestBody struct { epoch uint64 trusts []*Trust } // GetEpoch returns epoch in which the trust was assessed. -func (x *SendLocalTrustRequestBody) GetEpoch() uint64 { +func (x *AnnounceLocalTrustRequestBody) GetEpoch() uint64 { if x != nil { return x.epoch } @@ -222,14 +222,14 @@ func (x *SendLocalTrustRequestBody) GetEpoch() uint64 { } // SetEpoch sets epoch in which the trust was assessed. -func (x *SendLocalTrustRequestBody) SetEpoch(v uint64) { +func (x *AnnounceLocalTrustRequestBody) SetEpoch(v uint64) { if x != nil { x.epoch = v } } // GetTrusts returns list of normalized trust values. -func (x *SendLocalTrustRequestBody) GetTrusts() []*Trust { +func (x *AnnounceLocalTrustRequestBody) GetTrusts() []*Trust { if x != nil { return x.trusts } @@ -238,25 +238,25 @@ func (x *SendLocalTrustRequestBody) GetTrusts() []*Trust { } // SetTrusts sets list of normalized trust values. -func (x *SendLocalTrustRequestBody) SetTrusts(v []*Trust) { +func (x *AnnounceLocalTrustRequestBody) SetTrusts(v []*Trust) { if x != nil { x.trusts = v } } -// SendLocalTrustResponseBody is a structure of SendLocalTrust response body. -type SendLocalTrustResponseBody struct{} +// AnnounceLocalTrustResponseBody is a structure of AnnounceLocalTrust response body. +type AnnounceLocalTrustResponseBody struct{} -// SendLocalTrustRequest represents reputation.SendLocalTrustRequest +// AnnounceLocalTrustRequest represents reputation.AnnounceLocalTrustRequest // message from NeoFS API v2. -type SendLocalTrustRequest struct { - body *SendLocalTrustRequestBody +type AnnounceLocalTrustRequest struct { + body *AnnounceLocalTrustRequestBody session.RequestHeaders } // GetBody returns request body. -func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequestBody { +func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequestBody { if x != nil { return x.body } @@ -265,22 +265,22 @@ func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequestBody { } // SetBody sets request body. -func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequestBody) { +func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequestBody) { if x != nil { x.body = v } } -// SendLocalTrustResponse represents reputation.SendLocalTrustResponse +// AnnounceLocalTrustResponse represents reputation.AnnounceLocalTrustResponse // message from NeoFS API v2. -type SendLocalTrustResponse struct { - body *SendLocalTrustResponseBody +type AnnounceLocalTrustResponse struct { + body *AnnounceLocalTrustResponseBody session.ResponseHeaders } // GetBody returns response body. -func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponseBody { +func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponseBody { if x != nil { return x.body } @@ -289,14 +289,14 @@ func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponseBody { } // SetBody sets response body. -func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) { +func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponseBody) { if x != nil { x.body = v } } -// SendIntermediateResultRequestBody is a structure of SendIntermediateResult request body. -type SendIntermediateResultRequestBody struct { +// AnnounceIntermediateResultRequestBody is a structure of AnnounceIntermediateResult request body. +type AnnounceIntermediateResultRequestBody struct { epoch uint64 iter uint32 @@ -305,7 +305,7 @@ type SendIntermediateResultRequestBody struct { } // GetEpoch returns epoch number in which the intermediate trust was assessed. -func (x *SendIntermediateResultRequestBody) GetEpoch() uint64 { +func (x *AnnounceIntermediateResultRequestBody) GetEpoch() uint64 { if x != nil { return x.epoch } @@ -314,14 +314,14 @@ func (x *SendIntermediateResultRequestBody) GetEpoch() uint64 { } // SetEpoch sets epoch number in which the intermediate trust was assessed. -func (x *SendIntermediateResultRequestBody) SetEpoch(v uint64) { +func (x *AnnounceIntermediateResultRequestBody) SetEpoch(v uint64) { if x != nil { x.epoch = v } } // GetIteration returns sequence number of the iteration. -func (x *SendIntermediateResultRequestBody) GetIteration() uint32 { +func (x *AnnounceIntermediateResultRequestBody) GetIteration() uint32 { if x != nil { return x.iter } @@ -330,14 +330,14 @@ func (x *SendIntermediateResultRequestBody) GetIteration() uint32 { } // SetIteration sets sequence number of the iteration. -func (x *SendIntermediateResultRequestBody) SetIteration(v uint32) { +func (x *AnnounceIntermediateResultRequestBody) SetIteration(v uint32) { if x != nil { x.iter = v } } // GetTrust returns current global trust value. -func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { +func (x *AnnounceIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { if x != nil { return x.trust } @@ -346,25 +346,25 @@ func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust { } // SetTrust sets current global trust value. -func (x *SendIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) { +func (x *AnnounceIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) { if x != nil { x.trust = v } } -// SendLocalTrustResponseBody is a structure of SendIntermediateResult response body. -type SendIntermediateResultResponseBody struct{} +// AnnounceIntermediateResultResponseBody is a structure of AnnounceIntermediateResult response body. +type AnnounceIntermediateResultResponseBody struct{} -// SendIntermediateResultRequest represents reputation.SendIntermediateResult +// AnnounceIntermediateResultRequest represents reputation.AnnounceIntermediateResult // message from NeoFS API v2. -type SendIntermediateResultRequest struct { - body *SendIntermediateResultRequestBody +type AnnounceIntermediateResultRequest struct { + body *AnnounceIntermediateResultRequestBody session.RequestHeaders } // GetBody returns request body. -func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequestBody { +func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResultRequestBody { if x != nil { return x.body } @@ -373,22 +373,22 @@ func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequest } // SetBody sets request body. -func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequestBody) { +func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequestBody) { if x != nil { x.body = v } } -// SendIntermediateResultResponse represents reputation.SendIntermediateResultResponse +// AnnounceIntermediateResultResponse represents reputation.AnnounceIntermediateResultResponse // message from NeoFS API v2. -type SendIntermediateResultResponse struct { - body *SendIntermediateResultResponseBody +type AnnounceIntermediateResultResponse struct { + body *AnnounceIntermediateResultResponseBody session.ResponseHeaders } // GetBody returns response body. -func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultResponseBody { +func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResultResponseBody { if x != nil { return x.body } @@ -397,7 +397,7 @@ func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultRespon } // SetBody sets response body. -func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponseBody) { +func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponseBody) { if x != nil { x.body = v } diff --git a/v2/rpc/reputation.go b/v2/rpc/reputation.go index 88e2355..3706e38 100644 --- a/v2/rpc/reputation.go +++ b/v2/rpc/reputation.go @@ -9,19 +9,19 @@ import ( const serviceReputation = serviceNamePrefix + "reputation.ReputationService" const ( - rpcReputationSendLocalTrust = "SendLocalTrust" - rpcReputationSendIntermediateResult = "SendIntermediateResult" + rpcReputationAnnounceLocalTrust = "AnnounceLocalTrust" + rpcReputationAnnounceIntermediateResult = "AnnounceIntermediateResult" ) -// SendLocalTrust executes ReputationService.SendLocalTrust RPC. -func SendLocalTrust( +// AnnounceLocalTrust executes ReputationService.AnnounceLocalTrust RPC. +func AnnounceLocalTrust( cli *client.Client, - req *reputation.SendLocalTrustRequest, + req *reputation.AnnounceLocalTrustRequest, opts ...client.CallOption, -) (*reputation.SendLocalTrustResponse, error) { - resp := new(reputation.SendLocalTrustResponse) +) (*reputation.AnnounceLocalTrustResponse, error) { + resp := new(reputation.AnnounceLocalTrustResponse) - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationSendLocalTrust), req, resp, opts...) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationAnnounceLocalTrust), req, resp, opts...) if err != nil { return nil, err } @@ -29,15 +29,15 @@ func SendLocalTrust( return resp, nil } -// SendIntermediateResult executes ReputationService.SendIntermediateResult RPC. -func SendIntermediateResult( +// AnnounceIntermediateResult executes ReputationService.AnnounceIntermediateResult RPC. +func AnnounceIntermediateResult( cli *client.Client, - req *reputation.SendIntermediateResultRequest, + req *reputation.AnnounceIntermediateResultRequest, opts ...client.CallOption, -) (*reputation.SendIntermediateResultRequest, error) { - resp := new(reputation.SendIntermediateResultRequest) +) (*reputation.AnnounceIntermediateResultRequest, error) { + resp := new(reputation.AnnounceIntermediateResultRequest) - err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationSendIntermediateResult), req, resp, opts...) + err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceReputation, rpcReputationAnnounceIntermediateResult), req, resp, opts...) if err != nil { return nil, err } diff --git a/v2/signature/sign.go b/v2/signature/sign.go index d90fa32..33c7386 100644 --- a/v2/signature/sign.go +++ b/v2/signature/sign.go @@ -377,13 +377,13 @@ func serviceMessageBody(req interface{}) stableMarshaler { return v.GetBody() /* Reputation */ - case *reputation.SendLocalTrustRequest: + case *reputation.AnnounceLocalTrustRequest: return v.GetBody() - case *reputation.SendLocalTrustResponse: + case *reputation.AnnounceLocalTrustResponse: return v.GetBody() - case *reputation.SendIntermediateResultRequest: + case *reputation.AnnounceIntermediateResultRequest: return v.GetBody() - case *reputation.SendIntermediateResultResponse: + case *reputation.AnnounceIntermediateResultResponse: return v.GetBody() } }