Synchronize namings with NeoFS API v2.6.0

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-05-07 12:34:24 +03:00 committed by Alex Vanin
parent fcb2cce8a0
commit 099347d3bc
13 changed files with 269 additions and 265 deletions

View file

@ -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
}

View file

@ -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(),
)
}

View file

@ -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)

View file

@ -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
}

Binary file not shown.

View file

@ -4,10 +4,10 @@ import (
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
)
// SetValue sets binary ID.
func (x *PeerID) SetValue(v []byte) {
// SetPublicKey sets binary public key of ID.
func (x *PeerID) SetPublicKey(v []byte) {
if x != nil {
x.Value = v
x.PublicKey = v
}
}

Binary file not shown.

View file

@ -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))
}

View file

@ -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) },

View file

@ -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))

View file

@ -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
}

View file

@ -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
}

View file

@ -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()
}
}