forked from TrueCloudLab/frostfs-api-go
Synchronize namings with NeoFS API v2.6.0
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
fcb2cce8a0
commit
099347d3bc
13 changed files with 269 additions and 265 deletions
|
@ -13,45 +13,45 @@ import (
|
||||||
|
|
||||||
// Reputation contains methods for working with Reputation system values.
|
// Reputation contains methods for working with Reputation system values.
|
||||||
type Reputation interface {
|
type Reputation interface {
|
||||||
// SendLocalTrust sends local trust values of local peer.
|
// AnnounceLocalTrust announces local trust values of local peer.
|
||||||
SendLocalTrust(context.Context, SendLocalTrustPrm, ...CallOption) (*SendLocalTrustRes, error)
|
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.
|
// 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.
|
// AnnounceLocalTrustPrm groups parameters of AnnounceLocalTrust operation.
|
||||||
type SendLocalTrustPrm struct {
|
type AnnounceLocalTrustPrm struct {
|
||||||
epoch uint64
|
epoch uint64
|
||||||
|
|
||||||
trusts []*reputation.Trust
|
trusts []*reputation.Trust
|
||||||
}
|
}
|
||||||
|
|
||||||
// Epoch returns epoch in which the trust was assessed.
|
// Epoch returns epoch in which the trust was assessed.
|
||||||
func (x SendLocalTrustPrm) Epoch() uint64 {
|
func (x AnnounceLocalTrustPrm) Epoch() uint64 {
|
||||||
return x.epoch
|
return x.epoch
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEpoch sets epoch in which the trust was assessed.
|
// SetEpoch sets epoch in which the trust was assessed.
|
||||||
func (x *SendLocalTrustPrm) SetEpoch(epoch uint64) {
|
func (x *AnnounceLocalTrustPrm) SetEpoch(epoch uint64) {
|
||||||
x.epoch = epoch
|
x.epoch = epoch
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trusts returns list of local trust values.
|
// Trusts returns list of local trust values.
|
||||||
func (x SendLocalTrustPrm) Trusts() []*reputation.Trust {
|
func (x AnnounceLocalTrustPrm) Trusts() []*reputation.Trust {
|
||||||
return x.trusts
|
return x.trusts
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrusts sets list of local trust values.
|
// SetTrusts sets list of local trust values.
|
||||||
func (x *SendLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) {
|
func (x *AnnounceLocalTrustPrm) SetTrusts(trusts []*reputation.Trust) {
|
||||||
x.trusts = trusts
|
x.trusts = trusts
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendLocalTrustPrm groups results of SendLocalTrust operation.
|
// AnnounceLocalTrustRes groups results of AnnounceLocalTrust operation.
|
||||||
type SendLocalTrustRes struct{}
|
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
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -59,11 +59,11 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm,
|
||||||
opts[i](callOptions)
|
opts[i](callOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
reqBody := new(v2reputation.SendLocalTrustRequestBody)
|
reqBody := new(v2reputation.AnnounceLocalTrustRequestBody)
|
||||||
reqBody.SetEpoch(prm.Epoch())
|
reqBody.SetEpoch(prm.Epoch())
|
||||||
reqBody.SetTrusts(reputation.TrustsToV2(prm.Trusts()))
|
reqBody.SetTrusts(reputation.TrustsToV2(prm.Trusts()))
|
||||||
|
|
||||||
req := new(v2reputation.SendLocalTrustRequest)
|
req := new(v2reputation.AnnounceLocalTrustRequest)
|
||||||
req.SetBody(reqBody)
|
req.SetBody(reqBody)
|
||||||
req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions))
|
req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions))
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ func (c *clientImpl) SendLocalTrust(ctx context.Context, prm SendLocalTrustPrm,
|
||||||
return nil, err
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
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 nil, errors.Wrap(err, "can't verify response message")
|
||||||
}
|
}
|
||||||
|
|
||||||
return new(SendLocalTrustRes), nil
|
return new(AnnounceLocalTrustRes), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendIntermediateTrustPrm groups parameters of SendIntermediateTrust operation.
|
// AnnounceIntermediateTrustPrm groups parameters of AnnounceIntermediateTrust operation.
|
||||||
type SendIntermediateTrustPrm struct {
|
type AnnounceIntermediateTrustPrm struct {
|
||||||
epoch uint64
|
epoch uint64
|
||||||
|
|
||||||
iter uint32
|
iter uint32
|
||||||
|
@ -94,38 +94,38 @@ type SendIntermediateTrustPrm struct {
|
||||||
trust *reputation.PeerToPeerTrust
|
trust *reputation.PeerToPeerTrust
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendIntermediateTrustPrm) Epoch() uint64 {
|
func (x *AnnounceIntermediateTrustPrm) Epoch() uint64 {
|
||||||
return x.epoch
|
return x.epoch
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendIntermediateTrustPrm) SetEpoch(epoch uint64) {
|
func (x *AnnounceIntermediateTrustPrm) SetEpoch(epoch uint64) {
|
||||||
x.epoch = epoch
|
x.epoch = epoch
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iteration returns sequence number of the iteration.
|
// Iteration returns sequence number of the iteration.
|
||||||
func (x SendIntermediateTrustPrm) Iteration() uint32 {
|
func (x AnnounceIntermediateTrustPrm) Iteration() uint32 {
|
||||||
return x.iter
|
return x.iter
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIteration sets sequence number of the iteration.
|
// SetIteration sets sequence number of the iteration.
|
||||||
func (x *SendIntermediateTrustPrm) SetIteration(iter uint32) {
|
func (x *AnnounceIntermediateTrustPrm) SetIteration(iter uint32) {
|
||||||
x.iter = iter
|
x.iter = iter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trust returns current global trust value computed at the specified iteration.
|
// 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
|
return x.trust
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrust sets current global trust value computed at the specified iteration.
|
// 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
|
x.trust = trust
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendIntermediateTrustRes groups results of SendIntermediateTrust operation.
|
// AnnounceIntermediateTrustRes groups results of AnnounceIntermediateTrust operation.
|
||||||
type SendIntermediateTrustRes struct{}
|
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
|
// apply all available options
|
||||||
callOptions := c.defaultCallOptions()
|
callOptions := c.defaultCallOptions()
|
||||||
|
|
||||||
|
@ -133,12 +133,12 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed
|
||||||
opts[i](callOptions)
|
opts[i](callOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
reqBody := new(v2reputation.SendIntermediateResultRequestBody)
|
reqBody := new(v2reputation.AnnounceIntermediateResultRequestBody)
|
||||||
reqBody.SetEpoch(prm.Epoch())
|
reqBody.SetEpoch(prm.Epoch())
|
||||||
reqBody.SetIteration(prm.Iteration())
|
reqBody.SetIteration(prm.Iteration())
|
||||||
reqBody.SetTrust(prm.Trust().ToV2())
|
reqBody.SetTrust(prm.Trust().ToV2())
|
||||||
|
|
||||||
req := new(v2reputation.SendIntermediateResultRequest)
|
req := new(v2reputation.AnnounceIntermediateResultRequest)
|
||||||
req.SetBody(reqBody)
|
req.SetBody(reqBody)
|
||||||
req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions))
|
req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions))
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ func (c *clientImpl) SendIntermediateTrust(ctx context.Context, prm SendIntermed
|
||||||
return nil, err
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
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 nil, errors.Wrap(err, "can't verify response message")
|
||||||
}
|
}
|
||||||
|
|
||||||
return new(SendIntermediateTrustRes), nil
|
return new(AnnounceIntermediateTrustRes), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ func PeerIDFromV2(id *reputation.PeerID) *PeerID {
|
||||||
// SetPublicKey sets peer ID as a compressed public key.
|
// SetPublicKey sets peer ID as a compressed public key.
|
||||||
func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte) {
|
func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte) {
|
||||||
(*reputation.PeerID)(x).
|
(*reputation.PeerID)(x).
|
||||||
SetValue(v[:])
|
SetPublicKey(v[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToV2 converts PeerID to NeoFS API v2 reputation.PeerID message.
|
// 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.
|
// Equal returns true if identifiers are identical.
|
||||||
func (x *PeerID) Equal(x2 *PeerID) bool {
|
func (x *PeerID) Equal(x2 *PeerID) bool {
|
||||||
return bytes.Equal(
|
return bytes.Equal(
|
||||||
(*reputation.PeerID)(x).GetValue(),
|
(*reputation.PeerID)(x).GetPublicKey(),
|
||||||
(*reputation.PeerID)(x2).GetValue(),
|
(*reputation.PeerID)(x2).GetPublicKey(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func (x *PeerID) Parse(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
(*reputation.PeerID)(x).SetValue(data)
|
(*reputation.PeerID)(x).SetPublicKey(data)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ func (x *PeerID) Parse(s string) error {
|
||||||
func (x *PeerID) String() string {
|
func (x *PeerID) String() string {
|
||||||
return base58.Encode(
|
return base58.Encode(
|
||||||
(*reputation.PeerID)(x).
|
(*reputation.PeerID)(x).
|
||||||
GetValue(),
|
GetPublicKey(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ func (x *PeerID) ToGRPCMessage() grpc.Message {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
m = new(reputation.PeerID)
|
m = new(reputation.PeerID)
|
||||||
|
|
||||||
m.SetValue(x.val)
|
m.SetPublicKey(x.publicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
@ -32,7 +32,7 @@ func (x *PeerID) FromGRPCMessage(m grpc.Message) error {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
x.val = v.GetValue()
|
x.publicKey = v.GetPublicKey()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -300,13 +300,13 @@ func (x *GlobalTrust) FromGRPCMessage(m grpc.Message) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendLocalTrustRequestBody to gRPC-generated
|
// ToGRPCMessage converts AnnounceLocalTrustRequestBody to gRPC-generated
|
||||||
// reputation.SendLocalTrustRequest_Body message.
|
// reputation.AnnounceLocalTrustRequest_Body message.
|
||||||
func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceLocalTrustRequestBody) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendLocalTrustRequest_Body
|
var m *reputation.AnnounceLocalTrustRequest_Body
|
||||||
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
m = new(reputation.SendLocalTrustRequest_Body)
|
m = new(reputation.AnnounceLocalTrustRequest_Body)
|
||||||
|
|
||||||
m.SetEpoch(x.epoch)
|
m.SetEpoch(x.epoch)
|
||||||
m.SetTrusts(TrustsToGRPC(x.trusts))
|
m.SetTrusts(TrustsToGRPC(x.trusts))
|
||||||
|
@ -315,12 +315,12 @@ func (x *SendLocalTrustRequestBody) ToGRPCMessage() grpc.Message {
|
||||||
return m
|
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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendLocalTrustRequest_Body message.
|
// a gRPC-generated reputation.AnnounceLocalTrustRequest_Body message.
|
||||||
func (x *SendLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendLocalTrustRequest_Body)
|
v, ok := m.(*reputation.AnnounceLocalTrustRequest_Body)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -337,27 +337,27 @@ func (x *SendLocalTrustRequestBody) FromGRPCMessage(m grpc.Message) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendLocalTrustRequest to gRPC-generated
|
// ToGRPCMessage converts AnnounceLocalTrustRequest to gRPC-generated
|
||||||
// reputation.SendLocalTrustRequest message.
|
// reputation.AnnounceLocalTrustRequest message.
|
||||||
func (x *SendLocalTrustRequest) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceLocalTrustRequest) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendLocalTrustRequest
|
var m *reputation.AnnounceLocalTrustRequest
|
||||||
|
|
||||||
if x != nil {
|
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)
|
x.RequestHeaders.ToMessage(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendLocalTrustRequest message.
|
// a gRPC-generated reputation.AnnounceLocalTrustRequest message.
|
||||||
func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceLocalTrustRequest) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendLocalTrustRequest)
|
v, ok := m.(*reputation.AnnounceLocalTrustRequest)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error {
|
||||||
x.body = nil
|
x.body = nil
|
||||||
} else {
|
} else {
|
||||||
if x.body == nil {
|
if x.body == nil {
|
||||||
x.body = new(SendLocalTrustRequestBody)
|
x.body = new(AnnounceLocalTrustRequestBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = x.body.FromGRPCMessage(body)
|
err = x.body.FromGRPCMessage(body)
|
||||||
|
@ -381,24 +381,24 @@ func (x *SendLocalTrustRequest) FromGRPCMessage(m grpc.Message) error {
|
||||||
return x.RequestHeaders.FromMessage(v)
|
return x.RequestHeaders.FromMessage(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendLocalTrustResponseBody to gRPC-generated
|
// ToGRPCMessage converts AnnounceLocalTrustResponseBody to gRPC-generated
|
||||||
// reputation.SendLocalTrustResponse_Body message.
|
// reputation.AnnounceLocalTrustResponse_Body message.
|
||||||
func (x *SendLocalTrustResponseBody) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceLocalTrustResponseBody) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendLocalTrustResponse_Body
|
var m *reputation.AnnounceLocalTrustResponse_Body
|
||||||
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
m = new(reputation.SendLocalTrustResponse_Body)
|
m = new(reputation.AnnounceLocalTrustResponse_Body)
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendLocalTrustResponse_Body message.
|
// a gRPC-generated reputation.AnnounceLocalTrustResponse_Body message.
|
||||||
func (x *SendLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendLocalTrustResponse_Body)
|
v, ok := m.(*reputation.AnnounceLocalTrustResponse_Body)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -406,27 +406,27 @@ func (x *SendLocalTrustResponseBody) FromGRPCMessage(m grpc.Message) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendLocalTrustResponse to gRPC-generated
|
// ToGRPCMessage converts AnnounceLocalTrustResponse to gRPC-generated
|
||||||
// reputation.SendLocalTrustResponse message.
|
// reputation.AnnounceLocalTrustResponse message.
|
||||||
func (x *SendLocalTrustResponse) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceLocalTrustResponse) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendLocalTrustResponse
|
var m *reputation.AnnounceLocalTrustResponse
|
||||||
|
|
||||||
if x != nil {
|
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)
|
x.ResponseHeaders.ToMessage(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendLocalTrustResponse message.
|
// a gRPC-generated reputation.AnnounceLocalTrustResponse message.
|
||||||
func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceLocalTrustResponse) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendLocalTrustResponse)
|
v, ok := m.(*reputation.AnnounceLocalTrustResponse)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error {
|
||||||
x.body = nil
|
x.body = nil
|
||||||
} else {
|
} else {
|
||||||
if x.body == nil {
|
if x.body == nil {
|
||||||
x.body = new(SendLocalTrustResponseBody)
|
x.body = new(AnnounceLocalTrustResponseBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = x.body.FromGRPCMessage(body)
|
err = x.body.FromGRPCMessage(body)
|
||||||
|
@ -450,13 +450,13 @@ func (x *SendLocalTrustResponse) FromGRPCMessage(m grpc.Message) error {
|
||||||
return x.ResponseHeaders.FromMessage(v)
|
return x.ResponseHeaders.FromMessage(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendIntermediateResultRequestBody to gRPC-generated
|
// ToGRPCMessage converts AnnounceIntermediateResultRequestBody to gRPC-generated
|
||||||
// reputation.SendIntermediateResultRequest_Body message.
|
// reputation.AnnounceIntermediateResultRequest_Body message.
|
||||||
func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceIntermediateResultRequestBody) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendIntermediateResultRequest_Body
|
var m *reputation.AnnounceIntermediateResultRequest_Body
|
||||||
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
m = new(reputation.SendIntermediateResultRequest_Body)
|
m = new(reputation.AnnounceIntermediateResultRequest_Body)
|
||||||
|
|
||||||
m.SetEpoch(x.epoch)
|
m.SetEpoch(x.epoch)
|
||||||
m.SetIteration(x.iter)
|
m.SetIteration(x.iter)
|
||||||
|
@ -466,12 +466,12 @@ func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message {
|
||||||
return m
|
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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendIntermediateResultRequest_Body message.
|
// a gRPC-generated reputation.AnnounceIntermediateResultRequest_Body message.
|
||||||
func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendIntermediateResultRequest_Body)
|
v, ok := m.(*reputation.AnnounceIntermediateResultRequest_Body)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -496,27 +496,27 @@ func (x *SendIntermediateResultRequestBody) FromGRPCMessage(m grpc.Message) erro
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendIntermediateResultRequest to gRPC-generated
|
// ToGRPCMessage converts AnnounceIntermediateResultRequest to gRPC-generated
|
||||||
// reputation.SendIntermediateResultRequest message.
|
// reputation.AnnounceIntermediateResultRequest message.
|
||||||
func (x *SendIntermediateResultRequest) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceIntermediateResultRequest) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendIntermediateResultRequest
|
var m *reputation.AnnounceIntermediateResultRequest
|
||||||
|
|
||||||
if x != nil {
|
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)
|
x.RequestHeaders.ToMessage(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendIntermediateResultRequest message.
|
// a gRPC-generated reputation.AnnounceIntermediateResultRequest message.
|
||||||
func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendIntermediateResultRequest)
|
v, ok := m.(*reputation.AnnounceIntermediateResultRequest)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error {
|
||||||
x.body = nil
|
x.body = nil
|
||||||
} else {
|
} else {
|
||||||
if x.body == nil {
|
if x.body == nil {
|
||||||
x.body = new(SendIntermediateResultRequestBody)
|
x.body = new(AnnounceIntermediateResultRequestBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = x.body.FromGRPCMessage(body)
|
err = x.body.FromGRPCMessage(body)
|
||||||
|
@ -540,24 +540,24 @@ func (x *SendIntermediateResultRequest) FromGRPCMessage(m grpc.Message) error {
|
||||||
return x.RequestHeaders.FromMessage(v)
|
return x.RequestHeaders.FromMessage(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendIntermediateResultResponseBody to gRPC-generated
|
// ToGRPCMessage converts AnnounceIntermediateResultResponseBody to gRPC-generated
|
||||||
// reputation.SendIntermediateResultResponse_Body message.
|
// reputation.AnnounceIntermediateResultResponse_Body message.
|
||||||
func (x *SendIntermediateResultResponseBody) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceIntermediateResultResponseBody) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendIntermediateResultResponse_Body
|
var m *reputation.AnnounceIntermediateResultResponse_Body
|
||||||
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
m = new(reputation.SendIntermediateResultResponse_Body)
|
m = new(reputation.AnnounceIntermediateResultResponse_Body)
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendIntermediateResultResponse_Body message.
|
// a gRPC-generated reputation.AnnounceIntermediateResultResponse_Body message.
|
||||||
func (x *SendIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendIntermediateResultResponse_Body)
|
v, ok := m.(*reputation.AnnounceIntermediateResultResponse_Body)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -565,27 +565,27 @@ func (x *SendIntermediateResultResponseBody) FromGRPCMessage(m grpc.Message) err
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToGRPCMessage converts SendIntermediateResultResponse to gRPC-generated
|
// ToGRPCMessage converts AnnounceIntermediateResultResponse to gRPC-generated
|
||||||
// reputation.SendIntermediateResultResponse message.
|
// reputation.AnnounceIntermediateResultResponse message.
|
||||||
func (x *SendIntermediateResultResponse) ToGRPCMessage() grpc.Message {
|
func (x *AnnounceIntermediateResultResponse) ToGRPCMessage() grpc.Message {
|
||||||
var m *reputation.SendIntermediateResultResponse
|
var m *reputation.AnnounceIntermediateResultResponse
|
||||||
|
|
||||||
if x != nil {
|
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)
|
x.ResponseHeaders.ToMessage(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 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
|
// Returns message.ErrUnexpectedMessageType if m is not
|
||||||
// a gRPC-generated reputation.SendIntermediateResultResponse message.
|
// a gRPC-generated reputation.AnnounceIntermediateResultResponse message.
|
||||||
func (x *SendIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error {
|
func (x *AnnounceIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error {
|
||||||
v, ok := m.(*reputation.SendIntermediateResultResponse)
|
v, ok := m.(*reputation.AnnounceIntermediateResultResponse)
|
||||||
if !ok {
|
if !ok {
|
||||||
return message.NewUnexpectedMessageType(m, v)
|
return message.NewUnexpectedMessageType(m, v)
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ func (x *SendIntermediateResultResponse) FromGRPCMessage(m grpc.Message) error {
|
||||||
x.body = nil
|
x.body = nil
|
||||||
} else {
|
} else {
|
||||||
if x.body == nil {
|
if x.body == nil {
|
||||||
x.body = new(SendIntermediateResultResponseBody)
|
x.body = new(AnnounceIntermediateResultResponseBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = x.body.FromGRPCMessage(body)
|
err = x.body.FromGRPCMessage(body)
|
||||||
|
|
|
@ -5,119 +5,119 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetEpoch sets epoch in which the trust was assessed.
|
// 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 {
|
if x != nil {
|
||||||
x.Epoch = v
|
x.Epoch = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrusts sets list of normalized trust values.
|
// SetTrusts sets list of normalized trust values.
|
||||||
func (x *SendLocalTrustRequest_Body) SetTrusts(v []*Trust) {
|
func (x *AnnounceLocalTrustRequest_Body) SetTrusts(v []*Trust) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Trusts = v
|
x.Trusts = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets body of the request.
|
// SetBody sets body of the request.
|
||||||
func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequest_Body) {
|
func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequest_Body) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Body = v
|
x.Body = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMetaHeader sets meta header of the request.
|
// SetMetaHeader sets meta header of the request.
|
||||||
func (x *SendLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) {
|
func (x *AnnounceLocalTrustRequest) SetMetaHeader(v *session.RequestMetaHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.MetaHeader = v
|
x.MetaHeader = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVerifyHeader sets verification header of the request.
|
// SetVerifyHeader sets verification header of the request.
|
||||||
func (x *SendLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
|
func (x *AnnounceLocalTrustRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.VerifyHeader = v
|
x.VerifyHeader = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets body of the response.
|
// SetBody sets body of the response.
|
||||||
func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponse_Body) {
|
func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponse_Body) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Body = v
|
x.Body = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMetaHeader sets meta header of the response.
|
// SetMetaHeader sets meta header of the response.
|
||||||
func (x *SendLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
|
func (x *AnnounceLocalTrustResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.MetaHeader = v
|
x.MetaHeader = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVerifyHeader sets verification header of the response.
|
// SetVerifyHeader sets verification header of the response.
|
||||||
func (x *SendLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
|
func (x *AnnounceLocalTrustResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.VerifyHeader = v
|
x.VerifyHeader = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEpoch sets epoch in which the intermediate trust was assessed.
|
// 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 {
|
if x != nil {
|
||||||
x.Epoch = v
|
x.Epoch = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIteration sets sequence number of the iteration.
|
// SetIteration sets sequence number of the iteration.
|
||||||
func (x *SendIntermediateResultRequest_Body) SetIteration(v uint32) {
|
func (x *AnnounceIntermediateResultRequest_Body) SetIteration(v uint32) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Iteration = v
|
x.Iteration = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrust sets current global trust value.
|
// SetTrust sets current global trust value.
|
||||||
func (x *SendIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) {
|
func (x *AnnounceIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Trust = v
|
x.Trust = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets body of the request.
|
// SetBody sets body of the request.
|
||||||
func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequest_Body) {
|
func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequest_Body) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Body = v
|
x.Body = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMetaHeader sets meta header of the request.
|
// SetMetaHeader sets meta header of the request.
|
||||||
func (x *SendIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) {
|
func (x *AnnounceIntermediateResultRequest) SetMetaHeader(v *session.RequestMetaHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.MetaHeader = v
|
x.MetaHeader = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVerifyHeader sets verification header of the request.
|
// SetVerifyHeader sets verification header of the request.
|
||||||
func (x *SendIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
|
func (x *AnnounceIntermediateResultRequest) SetVerifyHeader(v *session.RequestVerificationHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.VerifyHeader = v
|
x.VerifyHeader = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets body of the response.
|
// SetBody sets body of the response.
|
||||||
func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponse_Body) {
|
func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponse_Body) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Body = v
|
x.Body = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMetaHeader sets meta header of the response.
|
// SetMetaHeader sets meta header of the response.
|
||||||
func (x *SendIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
|
func (x *AnnounceIntermediateResultResponse) SetMetaHeader(v *session.ResponseMetaHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.MetaHeader = v
|
x.MetaHeader = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVerifyHeader sets verification header of the response.
|
// SetVerifyHeader sets verification header of the response.
|
||||||
func (x *SendIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
|
func (x *AnnounceIntermediateResultResponse) SetVerifyHeader(v *session.ResponseVerificationHeader) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.VerifyHeader = v
|
x.VerifyHeader = v
|
||||||
}
|
}
|
||||||
|
|
BIN
v2/reputation/grpc/service.pb.go
generated
BIN
v2/reputation/grpc/service.pb.go
generated
Binary file not shown.
|
@ -4,10 +4,10 @@ import (
|
||||||
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
|
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetValue sets binary ID.
|
// SetPublicKey sets binary public key of ID.
|
||||||
func (x *PeerID) SetValue(v []byte) {
|
func (x *PeerID) SetPublicKey(v []byte) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.Value = v
|
x.PublicKey = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
v2/reputation/grpc/types.pb.go
generated
BIN
v2/reputation/grpc/types.pb.go
generated
Binary file not shown.
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_ = iota
|
_ = iota
|
||||||
peerIDValFNum
|
peerIDPubKeyFNum
|
||||||
)
|
)
|
||||||
|
|
||||||
func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) {
|
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())
|
buf = make([]byte, x.StableSize())
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := protoutil.BytesMarshal(peerIDValFNum, buf, x.val)
|
_, err := protoutil.BytesMarshal(peerIDPubKeyFNum, buf, x.publicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func (x *PeerID) StableMarshal(buf []byte) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PeerID) StableSize() (size int) {
|
func (x *PeerID) StableSize() (size int) {
|
||||||
size += protoutil.BytesSize(peerIDValFNum, x.val)
|
size += protoutil.BytesSize(peerIDPubKeyFNum, x.publicKey)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -212,11 +212,11 @@ func (x *GlobalTrust) Unmarshal(data []byte) error {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_ = iota
|
_ = iota
|
||||||
sendLocalTrustBodyEpochFNum
|
announceLocalTrustBodyEpochFNum
|
||||||
sendLocalTrustBodyTrustsFNum
|
announceLocalTrustBodyTrustsFNum
|
||||||
)
|
)
|
||||||
|
|
||||||
func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) {
|
func (x *AnnounceLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) {
|
||||||
if x == nil {
|
if x == nil {
|
||||||
return []byte{}, nil
|
return []byte{}, nil
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) {
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
n, err = protoutil.UInt64Marshal(sendLocalTrustBodyEpochFNum, buf[offset:], x.epoch)
|
n, err = protoutil.UInt64Marshal(announceLocalTrustBodyEpochFNum, buf[offset:], x.epoch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) {
|
||||||
offset += n
|
offset += n
|
||||||
|
|
||||||
for i := range x.trusts {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -249,40 +249,40 @@ func (x *SendLocalTrustRequestBody) StableMarshal(buf []byte) ([]byte, error) {
|
||||||
return buf, nil
|
return buf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendLocalTrustRequestBody) StableSize() (size int) {
|
func (x *AnnounceLocalTrustRequestBody) StableSize() (size int) {
|
||||||
size += protoutil.UInt64Size(sendLocalTrustBodyEpochFNum, x.epoch)
|
size += protoutil.UInt64Size(announceLocalTrustBodyEpochFNum, x.epoch)
|
||||||
|
|
||||||
for i := range x.trusts {
|
for i := range x.trusts {
|
||||||
size += protoutil.NestedStructureSize(sendLocalTrustBodyTrustsFNum, x.trusts[i])
|
size += protoutil.NestedStructureSize(announceLocalTrustBodyTrustsFNum, x.trusts[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendLocalTrustRequestBody) Unmarshal(data []byte) error {
|
func (x *AnnounceLocalTrustRequestBody) Unmarshal(data []byte) error {
|
||||||
return message.Unmarshal(x, data, new(reputation.SendLocalTrustRequest_Body))
|
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
|
return buf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendLocalTrustResponseBody) StableSize() int {
|
func (x *AnnounceLocalTrustResponseBody) StableSize() int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendLocalTrustResponseBody) Unmarshal(data []byte) error {
|
func (x *AnnounceLocalTrustResponseBody) Unmarshal(data []byte) error {
|
||||||
return message.Unmarshal(x, data, new(reputation.SendLocalTrustResponse_Body))
|
return message.Unmarshal(x, data, new(reputation.AnnounceLocalTrustResponse_Body))
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_ = iota
|
_ = iota
|
||||||
sendInterResBodyEpochFNum
|
announceInterResBodyEpochFNum
|
||||||
sendInterResBodyIterFNum
|
announceInterResBodyIterFNum
|
||||||
sendInterResBodyTrustFNum
|
announceInterResBodyTrustFNum
|
||||||
)
|
)
|
||||||
|
|
||||||
func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) {
|
func (x *AnnounceIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, error) {
|
||||||
if x == nil {
|
if x == nil {
|
||||||
return []byte{}, nil
|
return []byte{}, nil
|
||||||
}
|
}
|
||||||
|
@ -296,21 +296,21 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
n, err = protoutil.UInt64Marshal(sendInterResBodyEpochFNum, buf, x.epoch)
|
n, err = protoutil.UInt64Marshal(announceInterResBodyEpochFNum, buf, x.epoch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += n
|
offset += n
|
||||||
|
|
||||||
n, err = protoutil.UInt32Marshal(sendInterResBodyIterFNum, buf[offset:], x.iter)
|
n, err = protoutil.UInt32Marshal(announceInterResBodyIterFNum, buf[offset:], x.iter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += n
|
offset += n
|
||||||
|
|
||||||
_, err = protoutil.NestedStructureMarshal(sendInterResBodyTrustFNum, buf[offset:], x.trust)
|
_, err = protoutil.NestedStructureMarshal(announceInterResBodyTrustFNum, buf[offset:], x.trust)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -318,26 +318,26 @@ func (x *SendIntermediateResultRequestBody) StableMarshal(buf []byte) ([]byte, e
|
||||||
return buf, nil
|
return buf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendIntermediateResultRequestBody) StableSize() (size int) {
|
func (x *AnnounceIntermediateResultRequestBody) StableSize() (size int) {
|
||||||
size += protoutil.UInt64Size(sendInterResBodyEpochFNum, x.epoch)
|
size += protoutil.UInt64Size(announceInterResBodyEpochFNum, x.epoch)
|
||||||
size += protoutil.UInt32Size(sendInterResBodyIterFNum, x.iter)
|
size += protoutil.UInt32Size(announceInterResBodyIterFNum, x.iter)
|
||||||
size += protoutil.NestedStructureSize(sendInterResBodyTrustFNum, x.trust)
|
size += protoutil.NestedStructureSize(announceInterResBodyTrustFNum, x.trust)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendIntermediateResultRequestBody) Unmarshal(data []byte) error {
|
func (x *AnnounceIntermediateResultRequestBody) Unmarshal(data []byte) error {
|
||||||
return message.Unmarshal(x, data, new(reputation.SendIntermediateResultRequest_Body))
|
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
|
return buf, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendIntermediateResultResponseBody) StableSize() int {
|
func (x *AnnounceIntermediateResultResponseBody) StableSize() int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendIntermediateResultResponseBody) Unmarshal(data []byte) error {
|
func (x *AnnounceIntermediateResultResponseBody) Unmarshal(data []byte) error {
|
||||||
return message.Unmarshal(x, data, new(reputation.SendIntermediateResultResponse_Body))
|
return message.Unmarshal(x, data, new(reputation.AnnounceIntermediateResultResponse_Body))
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,22 @@ import (
|
||||||
func TestMessageConvert(t *testing.T) {
|
func TestMessageConvert(t *testing.T) {
|
||||||
messagetest.TestRPCMessage(t,
|
messagetest.TestRPCMessage(t,
|
||||||
func(empty bool) message.Message { return reputationtest.GenerateTrust(empty) },
|
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.GenerateAnnounceLocalTrustRequestBody(empty) },
|
||||||
func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustRequest(empty) },
|
func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustRequest(empty) },
|
||||||
func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponseBody(empty) },
|
func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponseBody(empty) },
|
||||||
func(empty bool) message.Message { return reputationtest.GenerateSendLocalTrustResponse(empty) },
|
func(empty bool) message.Message { return reputationtest.GenerateAnnounceLocalTrustResponse(empty) },
|
||||||
func(empty bool) message.Message {
|
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 {
|
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.GenerateGlobalTrustBody(empty) },
|
||||||
func(empty bool) message.Message { return reputationtest.GenerateGlobalTrust(empty) },
|
func(empty bool) message.Message { return reputationtest.GenerateGlobalTrust(empty) },
|
||||||
func(empty bool) message.Message { return reputationtest.GeneratePeerToPeerTrust(empty) },
|
func(empty bool) message.Message { return reputationtest.GeneratePeerToPeerTrust(empty) },
|
||||||
|
|
|
@ -10,7 +10,7 @@ func GeneratePeerID(empty bool) *reputation.PeerID {
|
||||||
m := new(reputation.PeerID)
|
m := new(reputation.PeerID)
|
||||||
|
|
||||||
if !empty {
|
if !empty {
|
||||||
m.SetValue([]byte{1, 2, 3})
|
m.SetPublicKey([]byte{1, 2, 3})
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
@ -67,8 +67,8 @@ func GenerateTrusts(empty bool) (res []*reputation.Trust) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendLocalTrustRequestBody(empty bool) *reputation.SendLocalTrustRequestBody {
|
func GenerateAnnounceLocalTrustRequestBody(empty bool) *reputation.AnnounceLocalTrustRequestBody {
|
||||||
m := new(reputation.SendLocalTrustRequestBody)
|
m := new(reputation.AnnounceLocalTrustRequestBody)
|
||||||
|
|
||||||
if !empty {
|
if !empty {
|
||||||
m.SetEpoch(13)
|
m.SetEpoch(13)
|
||||||
|
@ -79,34 +79,34 @@ func GenerateSendLocalTrustRequestBody(empty bool) *reputation.SendLocalTrustReq
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendLocalTrustRequest(empty bool) *reputation.SendLocalTrustRequest {
|
func GenerateAnnounceLocalTrustRequest(empty bool) *reputation.AnnounceLocalTrustRequest {
|
||||||
m := new(reputation.SendLocalTrustRequest)
|
m := new(reputation.AnnounceLocalTrustRequest)
|
||||||
|
|
||||||
m.SetBody(GenerateSendLocalTrustRequestBody(empty))
|
m.SetBody(GenerateAnnounceLocalTrustRequestBody(empty))
|
||||||
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
||||||
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendLocalTrustResponseBody(empty bool) *reputation.SendLocalTrustResponseBody {
|
func GenerateAnnounceLocalTrustResponseBody(empty bool) *reputation.AnnounceLocalTrustResponseBody {
|
||||||
m := new(reputation.SendLocalTrustResponseBody)
|
m := new(reputation.AnnounceLocalTrustResponseBody)
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendLocalTrustResponse(empty bool) *reputation.SendLocalTrustResponse {
|
func GenerateAnnounceLocalTrustResponse(empty bool) *reputation.AnnounceLocalTrustResponse {
|
||||||
m := new(reputation.SendLocalTrustResponse)
|
m := new(reputation.AnnounceLocalTrustResponse)
|
||||||
|
|
||||||
m.SetBody(GenerateSendLocalTrustResponseBody(empty))
|
m.SetBody(GenerateAnnounceLocalTrustResponseBody(empty))
|
||||||
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
||||||
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendIntermediateResultRequestBody {
|
func GenerateAnnounceIntermediateResultRequestBody(empty bool) *reputation.AnnounceIntermediateResultRequestBody {
|
||||||
m := new(reputation.SendIntermediateResultRequestBody)
|
m := new(reputation.AnnounceIntermediateResultRequestBody)
|
||||||
|
|
||||||
if !empty {
|
if !empty {
|
||||||
m.SetEpoch(123)
|
m.SetEpoch(123)
|
||||||
|
@ -117,26 +117,26 @@ func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendInter
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendIntermediateResultRequest(empty bool) *reputation.SendIntermediateResultRequest {
|
func GenerateAnnounceIntermediateResultRequest(empty bool) *reputation.AnnounceIntermediateResultRequest {
|
||||||
m := new(reputation.SendIntermediateResultRequest)
|
m := new(reputation.AnnounceIntermediateResultRequest)
|
||||||
|
|
||||||
m.SetBody(GenerateSendIntermediateResultRequestBody(empty))
|
m.SetBody(GenerateAnnounceIntermediateResultRequestBody(empty))
|
||||||
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
||||||
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendIntermediateResultResponseBody(empty bool) *reputation.SendIntermediateResultResponseBody {
|
func GenerateAnnounceIntermediateResultResponseBody(empty bool) *reputation.AnnounceIntermediateResultResponseBody {
|
||||||
m := new(reputation.SendIntermediateResultResponseBody)
|
m := new(reputation.AnnounceIntermediateResultResponseBody)
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateSendIntermediateResultResponse(empty bool) *reputation.SendIntermediateResultResponse {
|
func GenerateAnnounceIntermediateResultResponse(empty bool) *reputation.AnnounceIntermediateResultResponse {
|
||||||
m := new(reputation.SendIntermediateResultResponse)
|
m := new(reputation.AnnounceIntermediateResultResponse)
|
||||||
|
|
||||||
m.SetBody(GenerateSendIntermediateResultResponseBody(empty))
|
m.SetBody(GenerateAnnounceIntermediateResultResponseBody(empty))
|
||||||
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
||||||
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
||||||
|
|
||||||
|
|
|
@ -8,22 +8,22 @@ import (
|
||||||
// PeerID represents reputation.PeerID message
|
// PeerID represents reputation.PeerID message
|
||||||
// from NeoFS API v2.
|
// from NeoFS API v2.
|
||||||
type PeerID struct {
|
type PeerID struct {
|
||||||
val []byte
|
publicKey []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetValue returns peer's binary ID.
|
// GetPublicKey returns peer's binary public key of ID.
|
||||||
func (x *PeerID) GetValue() []byte {
|
func (x *PeerID) GetPublicKey() []byte {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.val
|
return x.publicKey
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetValue sets peer's binary ID.
|
// SetPublicKey sets peer's binary public key of ID.
|
||||||
func (x *PeerID) SetValue(v []byte) {
|
func (x *PeerID) SetPublicKey(v []byte) {
|
||||||
if x != nil {
|
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.
|
// AnnounceLocalTrustRequestBody is a structure of AnnounceLocalTrust request body.
|
||||||
type SendLocalTrustRequestBody struct {
|
type AnnounceLocalTrustRequestBody struct {
|
||||||
epoch uint64
|
epoch uint64
|
||||||
|
|
||||||
trusts []*Trust
|
trusts []*Trust
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEpoch returns epoch in which the trust was assessed.
|
// GetEpoch returns epoch in which the trust was assessed.
|
||||||
func (x *SendLocalTrustRequestBody) GetEpoch() uint64 {
|
func (x *AnnounceLocalTrustRequestBody) GetEpoch() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.epoch
|
return x.epoch
|
||||||
}
|
}
|
||||||
|
@ -222,14 +222,14 @@ func (x *SendLocalTrustRequestBody) GetEpoch() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEpoch sets epoch in which the trust was assessed.
|
// SetEpoch sets epoch in which the trust was assessed.
|
||||||
func (x *SendLocalTrustRequestBody) SetEpoch(v uint64) {
|
func (x *AnnounceLocalTrustRequestBody) SetEpoch(v uint64) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.epoch = v
|
x.epoch = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTrusts returns list of normalized trust values.
|
// GetTrusts returns list of normalized trust values.
|
||||||
func (x *SendLocalTrustRequestBody) GetTrusts() []*Trust {
|
func (x *AnnounceLocalTrustRequestBody) GetTrusts() []*Trust {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.trusts
|
return x.trusts
|
||||||
}
|
}
|
||||||
|
@ -238,25 +238,25 @@ func (x *SendLocalTrustRequestBody) GetTrusts() []*Trust {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrusts sets list of normalized trust values.
|
// SetTrusts sets list of normalized trust values.
|
||||||
func (x *SendLocalTrustRequestBody) SetTrusts(v []*Trust) {
|
func (x *AnnounceLocalTrustRequestBody) SetTrusts(v []*Trust) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.trusts = v
|
x.trusts = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendLocalTrustResponseBody is a structure of SendLocalTrust response body.
|
// AnnounceLocalTrustResponseBody is a structure of AnnounceLocalTrust response body.
|
||||||
type SendLocalTrustResponseBody struct{}
|
type AnnounceLocalTrustResponseBody struct{}
|
||||||
|
|
||||||
// SendLocalTrustRequest represents reputation.SendLocalTrustRequest
|
// AnnounceLocalTrustRequest represents reputation.AnnounceLocalTrustRequest
|
||||||
// message from NeoFS API v2.
|
// message from NeoFS API v2.
|
||||||
type SendLocalTrustRequest struct {
|
type AnnounceLocalTrustRequest struct {
|
||||||
body *SendLocalTrustRequestBody
|
body *AnnounceLocalTrustRequestBody
|
||||||
|
|
||||||
session.RequestHeaders
|
session.RequestHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBody returns request body.
|
// GetBody returns request body.
|
||||||
func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequestBody {
|
func (x *AnnounceLocalTrustRequest) GetBody() *AnnounceLocalTrustRequestBody {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.body
|
return x.body
|
||||||
}
|
}
|
||||||
|
@ -265,22 +265,22 @@ func (x *SendLocalTrustRequest) GetBody() *SendLocalTrustRequestBody {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets request body.
|
// SetBody sets request body.
|
||||||
func (x *SendLocalTrustRequest) SetBody(v *SendLocalTrustRequestBody) {
|
func (x *AnnounceLocalTrustRequest) SetBody(v *AnnounceLocalTrustRequestBody) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.body = v
|
x.body = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendLocalTrustResponse represents reputation.SendLocalTrustResponse
|
// AnnounceLocalTrustResponse represents reputation.AnnounceLocalTrustResponse
|
||||||
// message from NeoFS API v2.
|
// message from NeoFS API v2.
|
||||||
type SendLocalTrustResponse struct {
|
type AnnounceLocalTrustResponse struct {
|
||||||
body *SendLocalTrustResponseBody
|
body *AnnounceLocalTrustResponseBody
|
||||||
|
|
||||||
session.ResponseHeaders
|
session.ResponseHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBody returns response body.
|
// GetBody returns response body.
|
||||||
func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponseBody {
|
func (x *AnnounceLocalTrustResponse) GetBody() *AnnounceLocalTrustResponseBody {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.body
|
return x.body
|
||||||
}
|
}
|
||||||
|
@ -289,14 +289,14 @@ func (x *SendLocalTrustResponse) GetBody() *SendLocalTrustResponseBody {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets response body.
|
// SetBody sets response body.
|
||||||
func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) {
|
func (x *AnnounceLocalTrustResponse) SetBody(v *AnnounceLocalTrustResponseBody) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.body = v
|
x.body = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendIntermediateResultRequestBody is a structure of SendIntermediateResult request body.
|
// AnnounceIntermediateResultRequestBody is a structure of AnnounceIntermediateResult request body.
|
||||||
type SendIntermediateResultRequestBody struct {
|
type AnnounceIntermediateResultRequestBody struct {
|
||||||
epoch uint64
|
epoch uint64
|
||||||
|
|
||||||
iter uint32
|
iter uint32
|
||||||
|
@ -305,7 +305,7 @@ type SendIntermediateResultRequestBody struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEpoch returns epoch number in which the intermediate trust was assessed.
|
// GetEpoch returns epoch number in which the intermediate trust was assessed.
|
||||||
func (x *SendIntermediateResultRequestBody) GetEpoch() uint64 {
|
func (x *AnnounceIntermediateResultRequestBody) GetEpoch() uint64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.epoch
|
return x.epoch
|
||||||
}
|
}
|
||||||
|
@ -314,14 +314,14 @@ func (x *SendIntermediateResultRequestBody) GetEpoch() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEpoch sets epoch number in which the intermediate trust was assessed.
|
// 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 {
|
if x != nil {
|
||||||
x.epoch = v
|
x.epoch = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIteration returns sequence number of the iteration.
|
// GetIteration returns sequence number of the iteration.
|
||||||
func (x *SendIntermediateResultRequestBody) GetIteration() uint32 {
|
func (x *AnnounceIntermediateResultRequestBody) GetIteration() uint32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.iter
|
return x.iter
|
||||||
}
|
}
|
||||||
|
@ -330,14 +330,14 @@ func (x *SendIntermediateResultRequestBody) GetIteration() uint32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIteration sets sequence number of the iteration.
|
// SetIteration sets sequence number of the iteration.
|
||||||
func (x *SendIntermediateResultRequestBody) SetIteration(v uint32) {
|
func (x *AnnounceIntermediateResultRequestBody) SetIteration(v uint32) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.iter = v
|
x.iter = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTrust returns current global trust value.
|
// GetTrust returns current global trust value.
|
||||||
func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust {
|
func (x *AnnounceIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.trust
|
return x.trust
|
||||||
}
|
}
|
||||||
|
@ -346,25 +346,25 @@ func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTrust sets current global trust value.
|
// SetTrust sets current global trust value.
|
||||||
func (x *SendIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) {
|
func (x *AnnounceIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.trust = v
|
x.trust = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendLocalTrustResponseBody is a structure of SendIntermediateResult response body.
|
// AnnounceIntermediateResultResponseBody is a structure of AnnounceIntermediateResult response body.
|
||||||
type SendIntermediateResultResponseBody struct{}
|
type AnnounceIntermediateResultResponseBody struct{}
|
||||||
|
|
||||||
// SendIntermediateResultRequest represents reputation.SendIntermediateResult
|
// AnnounceIntermediateResultRequest represents reputation.AnnounceIntermediateResult
|
||||||
// message from NeoFS API v2.
|
// message from NeoFS API v2.
|
||||||
type SendIntermediateResultRequest struct {
|
type AnnounceIntermediateResultRequest struct {
|
||||||
body *SendIntermediateResultRequestBody
|
body *AnnounceIntermediateResultRequestBody
|
||||||
|
|
||||||
session.RequestHeaders
|
session.RequestHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBody returns request body.
|
// GetBody returns request body.
|
||||||
func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequestBody {
|
func (x *AnnounceIntermediateResultRequest) GetBody() *AnnounceIntermediateResultRequestBody {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.body
|
return x.body
|
||||||
}
|
}
|
||||||
|
@ -373,22 +373,22 @@ func (x *SendIntermediateResultRequest) GetBody() *SendIntermediateResultRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets request body.
|
// SetBody sets request body.
|
||||||
func (x *SendIntermediateResultRequest) SetBody(v *SendIntermediateResultRequestBody) {
|
func (x *AnnounceIntermediateResultRequest) SetBody(v *AnnounceIntermediateResultRequestBody) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.body = v
|
x.body = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendIntermediateResultResponse represents reputation.SendIntermediateResultResponse
|
// AnnounceIntermediateResultResponse represents reputation.AnnounceIntermediateResultResponse
|
||||||
// message from NeoFS API v2.
|
// message from NeoFS API v2.
|
||||||
type SendIntermediateResultResponse struct {
|
type AnnounceIntermediateResultResponse struct {
|
||||||
body *SendIntermediateResultResponseBody
|
body *AnnounceIntermediateResultResponseBody
|
||||||
|
|
||||||
session.ResponseHeaders
|
session.ResponseHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBody returns response body.
|
// GetBody returns response body.
|
||||||
func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultResponseBody {
|
func (x *AnnounceIntermediateResultResponse) GetBody() *AnnounceIntermediateResultResponseBody {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.body
|
return x.body
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ func (x *SendIntermediateResultResponse) GetBody() *SendIntermediateResultRespon
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBody sets response body.
|
// SetBody sets response body.
|
||||||
func (x *SendIntermediateResultResponse) SetBody(v *SendIntermediateResultResponseBody) {
|
func (x *AnnounceIntermediateResultResponse) SetBody(v *AnnounceIntermediateResultResponseBody) {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
x.body = v
|
x.body = v
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,19 +9,19 @@ import (
|
||||||
const serviceReputation = serviceNamePrefix + "reputation.ReputationService"
|
const serviceReputation = serviceNamePrefix + "reputation.ReputationService"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
rpcReputationSendLocalTrust = "SendLocalTrust"
|
rpcReputationAnnounceLocalTrust = "AnnounceLocalTrust"
|
||||||
rpcReputationSendIntermediateResult = "SendIntermediateResult"
|
rpcReputationAnnounceIntermediateResult = "AnnounceIntermediateResult"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SendLocalTrust executes ReputationService.SendLocalTrust RPC.
|
// AnnounceLocalTrust executes ReputationService.AnnounceLocalTrust RPC.
|
||||||
func SendLocalTrust(
|
func AnnounceLocalTrust(
|
||||||
cli *client.Client,
|
cli *client.Client,
|
||||||
req *reputation.SendLocalTrustRequest,
|
req *reputation.AnnounceLocalTrustRequest,
|
||||||
opts ...client.CallOption,
|
opts ...client.CallOption,
|
||||||
) (*reputation.SendLocalTrustResponse, error) {
|
) (*reputation.AnnounceLocalTrustResponse, error) {
|
||||||
resp := new(reputation.SendLocalTrustResponse)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,15 @@ func SendLocalTrust(
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendIntermediateResult executes ReputationService.SendIntermediateResult RPC.
|
// AnnounceIntermediateResult executes ReputationService.AnnounceIntermediateResult RPC.
|
||||||
func SendIntermediateResult(
|
func AnnounceIntermediateResult(
|
||||||
cli *client.Client,
|
cli *client.Client,
|
||||||
req *reputation.SendIntermediateResultRequest,
|
req *reputation.AnnounceIntermediateResultRequest,
|
||||||
opts ...client.CallOption,
|
opts ...client.CallOption,
|
||||||
) (*reputation.SendIntermediateResultRequest, error) {
|
) (*reputation.AnnounceIntermediateResultRequest, error) {
|
||||||
resp := new(reputation.SendIntermediateResultRequest)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,13 +377,13 @@ func serviceMessageBody(req interface{}) stableMarshaler {
|
||||||
return v.GetBody()
|
return v.GetBody()
|
||||||
|
|
||||||
/* Reputation */
|
/* Reputation */
|
||||||
case *reputation.SendLocalTrustRequest:
|
case *reputation.AnnounceLocalTrustRequest:
|
||||||
return v.GetBody()
|
return v.GetBody()
|
||||||
case *reputation.SendLocalTrustResponse:
|
case *reputation.AnnounceLocalTrustResponse:
|
||||||
return v.GetBody()
|
return v.GetBody()
|
||||||
case *reputation.SendIntermediateResultRequest:
|
case *reputation.AnnounceIntermediateResultRequest:
|
||||||
return v.GetBody()
|
return v.GetBody()
|
||||||
case *reputation.SendIntermediateResultResponse:
|
case *reputation.AnnounceIntermediateResultResponse:
|
||||||
return v.GetBody()
|
return v.GetBody()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue