forked from TrueCloudLab/frostfs-api-go
[#265] v2/reputation: Support PeerToPeerTrust message
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
771f395d9d
commit
269288119d
10 changed files with 353 additions and 104 deletions
|
@ -81,6 +81,61 @@ func (x *Trust) FromGRPCMessage(m grpc.Message) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ToGRPCMessage converts PeerToPeerTrust to gRPC-generated
|
||||
// reputation.PeerToPeerTrust message.
|
||||
func (x *PeerToPeerTrust) ToGRPCMessage() grpc.Message {
|
||||
var m *reputation.PeerToPeerTrust
|
||||
|
||||
if x != nil {
|
||||
m = new(reputation.PeerToPeerTrust)
|
||||
|
||||
m.SetTrustingPeer(x.trusting.ToGRPCMessage().(*reputation.PeerID))
|
||||
m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// FromGRPCMessage tries to restore PeerToPeerTrust from grpc.Message.
|
||||
//
|
||||
// Returns message.ErrUnexpectedMessageType if m is not
|
||||
// a gRPC-generated reputation.PeerToPeerTrust message.
|
||||
func (x *PeerToPeerTrust) FromGRPCMessage(m grpc.Message) error {
|
||||
v, ok := m.(*reputation.PeerToPeerTrust)
|
||||
if !ok {
|
||||
return message.NewUnexpectedMessageType(m, v)
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
trusting := v.GetTrustingPeer()
|
||||
if trusting == nil {
|
||||
x.trusting = nil
|
||||
} else {
|
||||
if x.trusting == nil {
|
||||
x.trusting = new(PeerID)
|
||||
}
|
||||
|
||||
err = x.trusting.FromGRPCMessage(trusting)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
trust := v.GetTrust()
|
||||
if trust == nil {
|
||||
x.trust = nil
|
||||
} else {
|
||||
if x.trust == nil {
|
||||
x.trust = new(Trust)
|
||||
}
|
||||
|
||||
err = x.trust.FromGRPCMessage(trust)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// TrustsToGRPC converts slice of Trust structures
|
||||
// to slice of gRPC-generated Trust messages.
|
||||
func TrustsToGRPC(xs []*Trust) (res []*reputation.Trust) {
|
||||
|
@ -404,7 +459,7 @@ func (x *SendIntermediateResultRequestBody) ToGRPCMessage() grpc.Message {
|
|||
m = new(reputation.SendIntermediateResultRequest_Body)
|
||||
|
||||
m.SetIteration(x.iter)
|
||||
m.SetTrust(x.trust.ToGRPCMessage().(*reputation.Trust))
|
||||
m.SetTrust(x.trust.ToGRPCMessage().(*reputation.PeerToPeerTrust))
|
||||
}
|
||||
|
||||
return m
|
||||
|
|
|
@ -68,7 +68,7 @@ func (x *SendIntermediateResultRequest_Body) SetIteration(v uint32) {
|
|||
}
|
||||
|
||||
// SetTrust sets current global trust value.
|
||||
func (x *SendIntermediateResultRequest_Body) SetTrust(v *Trust) {
|
||||
func (x *SendIntermediateResultRequest_Body) SetTrust(v *PeerToPeerTrust) {
|
||||
if x != nil {
|
||||
x.Trust = v
|
||||
}
|
||||
|
|
99
v2/reputation/grpc/service.pb.go
generated
99
v2/reputation/grpc/service.pb.go
generated
|
@ -418,7 +418,7 @@ type SendIntermediateResultRequest_Body struct {
|
|||
// Sequence number of the iteration.
|
||||
Iteration uint32 `protobuf:"varint,1,opt,name=iteration,proto3" json:"iteration,omitempty"`
|
||||
// Current global trust value computed at the specified iteration.
|
||||
Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"`
|
||||
Trust *PeerToPeerTrust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SendIntermediateResultRequest_Body) Reset() {
|
||||
|
@ -460,7 +460,7 @@ func (x *SendIntermediateResultRequest_Body) GetIteration() uint32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (x *SendIntermediateResultRequest_Body) GetTrust() *Trust {
|
||||
func (x *SendIntermediateResultRequest_Body) GetTrust() *PeerToPeerTrust {
|
||||
if x != nil {
|
||||
return x.Trust
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{
|
|||
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64,
|
||||
0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
|
||||
0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xe0, 0x02, 0x0a, 0x1d, 0x53, 0x65, 0x6e,
|
||||
0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xea, 0x02, 0x0a, 0x1d, 0x53, 0x65, 0x6e,
|
||||
0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73,
|
||||
0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x04, 0x62, 0x6f,
|
||||
0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66,
|
||||
|
@ -570,53 +570,53 @@ var file_v2_reputation_grpc_service_proto_rawDesc = []byte{
|
|||
0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65,
|
||||
0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64,
|
||||
0x65, 0x72, 0x1a, 0x57, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74,
|
||||
0x65, 0x72, 0x1a, 0x61, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74,
|
||||
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69,
|
||||
0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73,
|
||||
0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54,
|
||||
0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e,
|
||||
0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65,
|
||||
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d,
|
||||
0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e,
|
||||
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64,
|
||||
0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a,
|
||||
0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48,
|
||||
0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f,
|
||||
0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e,
|
||||
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72,
|
||||
0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64,
|
||||
0x79, 0x32, 0x86, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c,
|
||||
0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
|
||||
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e,
|
||||
0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73,
|
||||
0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50,
|
||||
0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05,
|
||||
0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0x93, 0x02, 0x0a, 0x1e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e,
|
||||
0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65,
|
||||
0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12,
|
||||
0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75,
|
||||
0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72,
|
||||
0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
|
||||
0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64,
|
||||
0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75,
|
||||
0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64,
|
||||
0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f,
|
||||
0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72,
|
||||
0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e,
|
||||
0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e,
|
||||
0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65,
|
||||
0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64,
|
||||
0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f,
|
||||
0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e,
|
||||
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61,
|
||||
0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12,
|
||||
0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e,
|
||||
0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48,
|
||||
0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61,
|
||||
0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x86, 0x02, 0x0a, 0x11,
|
||||
0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x12, 0x6b, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72,
|
||||
0x75, 0x73, 0x74, 0x12, 0x2b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
|
||||
0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c,
|
||||
0x6f, 0x63, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70,
|
||||
0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x63, 0x61,
|
||||
0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83,
|
||||
0x01, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69,
|
||||
0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x33, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
|
||||
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74,
|
||||
0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34,
|
||||
0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d,
|
||||
0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f,
|
||||
0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70,
|
||||
0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70,
|
||||
0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69,
|
||||
0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65,
|
||||
0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -646,6 +646,7 @@ var file_v2_reputation_grpc_service_proto_goTypes = []interface{}{
|
|||
(*grpc.ResponseMetaHeader)(nil), // 10: neo.fs.v2.session.ResponseMetaHeader
|
||||
(*grpc.ResponseVerificationHeader)(nil), // 11: neo.fs.v2.session.ResponseVerificationHeader
|
||||
(*Trust)(nil), // 12: neo.fs.v2.reputation.Trust
|
||||
(*PeerToPeerTrust)(nil), // 13: neo.fs.v2.reputation.PeerToPeerTrust
|
||||
}
|
||||
var file_v2_reputation_grpc_service_proto_depIdxs = []int32{
|
||||
4, // 0: neo.fs.v2.reputation.SendLocalTrustRequest.body:type_name -> neo.fs.v2.reputation.SendLocalTrustRequest.Body
|
||||
|
@ -661,7 +662,7 @@ var file_v2_reputation_grpc_service_proto_depIdxs = []int32{
|
|||
10, // 10: neo.fs.v2.reputation.SendIntermediateResultResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader
|
||||
11, // 11: neo.fs.v2.reputation.SendIntermediateResultResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader
|
||||
12, // 12: neo.fs.v2.reputation.SendLocalTrustRequest.Body.trusts:type_name -> neo.fs.v2.reputation.Trust
|
||||
12, // 13: neo.fs.v2.reputation.SendIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.Trust
|
||||
13, // 13: neo.fs.v2.reputation.SendIntermediateResultRequest.Body.trust:type_name -> neo.fs.v2.reputation.PeerToPeerTrust
|
||||
0, // 14: neo.fs.v2.reputation.ReputationService.SendLocalTrust:input_type -> neo.fs.v2.reputation.SendLocalTrustRequest
|
||||
2, // 15: neo.fs.v2.reputation.ReputationService.SendIntermediateResult:input_type -> neo.fs.v2.reputation.SendIntermediateResultRequest
|
||||
1, // 16: neo.fs.v2.reputation.ReputationService.SendLocalTrust:output_type -> neo.fs.v2.reputation.SendLocalTrustResponse
|
||||
|
|
|
@ -25,6 +25,20 @@ func (x *Trust) SetValue(v float64) {
|
|||
}
|
||||
}
|
||||
|
||||
// SetTrustingPeer sets trusting peer ID.
|
||||
func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) {
|
||||
if x != nil {
|
||||
x.TrustingPeer = v
|
||||
}
|
||||
}
|
||||
|
||||
// SetTrust sets trust value of trusting peer to the trusted one.
|
||||
func (x *PeerToPeerTrust) SetTrust(v *Trust) {
|
||||
if x != nil {
|
||||
x.Trust = v
|
||||
}
|
||||
}
|
||||
|
||||
// SetManager sets manager ID.
|
||||
func (x *GlobalTrust_Body) SetManager(v *PeerID) {
|
||||
if x != nil {
|
||||
|
|
180
v2/reputation/grpc/types.pb.go
generated
180
v2/reputation/grpc/types.pb.go
generated
|
@ -145,6 +145,64 @@ func (x *Trust) GetValue() float64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
// Trust value of a peer to a peer.
|
||||
type PeerToPeerTrust struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Identifier of the trusting peer.
|
||||
TrustingPeer *PeerID `protobuf:"bytes,1,opt,name=trusting_peer,json=trustingPeer,proto3" json:"trusting_peer,omitempty"`
|
||||
// Trust value.
|
||||
Trust *Trust `protobuf:"bytes,2,opt,name=trust,proto3" json:"trust,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) Reset() {
|
||||
*x = PeerToPeerTrust{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PeerToPeerTrust) ProtoMessage() {}
|
||||
|
||||
func (x *PeerToPeerTrust) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PeerToPeerTrust.ProtoReflect.Descriptor instead.
|
||||
func (*PeerToPeerTrust) Descriptor() ([]byte, []int) {
|
||||
return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID {
|
||||
if x != nil {
|
||||
return x.TrustingPeer
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) GetTrust() *Trust {
|
||||
if x != nil {
|
||||
return x.Trust
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Global trust value to NeoFS network peer.
|
||||
type GlobalTrust struct {
|
||||
state protoimpl.MessageState
|
||||
|
@ -163,7 +221,7 @@ type GlobalTrust struct {
|
|||
func (x *GlobalTrust) Reset() {
|
||||
*x = GlobalTrust{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[2]
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -176,7 +234,7 @@ func (x *GlobalTrust) String() string {
|
|||
func (*GlobalTrust) ProtoMessage() {}
|
||||
|
||||
func (x *GlobalTrust) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[2]
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -189,7 +247,7 @@ func (x *GlobalTrust) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use GlobalTrust.ProtoReflect.Descriptor instead.
|
||||
func (*GlobalTrust) Descriptor() ([]byte, []int) {
|
||||
return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2}
|
||||
return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GlobalTrust) GetVersion() *grpc.Version {
|
||||
|
@ -228,7 +286,7 @@ type GlobalTrust_Body struct {
|
|||
func (x *GlobalTrust_Body) Reset() {
|
||||
*x = GlobalTrust_Body{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[3]
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -241,7 +299,7 @@ func (x *GlobalTrust_Body) String() string {
|
|||
func (*GlobalTrust_Body) ProtoMessage() {}
|
||||
|
||||
func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[3]
|
||||
mi := &file_v2_reputation_grpc_types_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -254,7 +312,7 @@ func (x *GlobalTrust_Body) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use GlobalTrust_Body.ProtoReflect.Descriptor instead.
|
||||
func (*GlobalTrust_Body) Descriptor() ([]byte, []int) {
|
||||
return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{2, 0}
|
||||
return file_v2_reputation_grpc_types_proto_rawDescGZIP(), []int{3, 0}
|
||||
}
|
||||
|
||||
func (x *GlobalTrust_Body) GetManager() *PeerID {
|
||||
|
@ -286,32 +344,41 @@ var file_v2_reputation_grpc_types_proto_rawDesc = []byte{
|
|||
0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50,
|
||||
0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76,
|
||||
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x22, 0xa8, 0x02, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73,
|
||||
0x74, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72,
|
||||
0x65, 0x66, 0x73, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72,
|
||||
0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c,
|
||||
0x54, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79,
|
||||
0x12, 0x37, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
|
||||
0x72, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09,
|
||||
0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64,
|
||||
0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72,
|
||||
0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44,
|
||||
0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75,
|
||||
0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66,
|
||||
0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
|
||||
0x54, 0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f,
|
||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63,
|
||||
0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67,
|
||||
0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f,
|
||||
0x67, 0x72, 0x70, 0x63, 0x3b, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa,
|
||||
0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67,
|
||||
0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72,
|
||||
0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x74, 0x72, 0x75, 0x73, 0x74, 0x69, 0x6e,
|
||||
0x67, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e,
|
||||
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x0c, 0x74, 0x72, 0x75, 0x73,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73,
|
||||
0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54,
|
||||
0x72, 0x75, 0x73, 0x74, 0x52, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x22, 0xa8, 0x02, 0x0a, 0x0b,
|
||||
0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x07, 0x76,
|
||||
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e,
|
||||
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x56, 0x65,
|
||||
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3a,
|
||||
0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6e,
|
||||
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x54, 0x72, 0x75, 0x73, 0x74, 0x2e,
|
||||
0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x37, 0x0a, 0x09, 0x73, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
|
||||
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x1a, 0x71, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x36, 0x0a, 0x07, 0x6d,
|
||||
0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e,
|
||||
0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x61,
|
||||
0x67, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72,
|
||||
0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x75, 0x73, 0x74, 0x52,
|
||||
0x05, 0x74, 0x72, 0x75, 0x73, 0x74, 0x42, 0x62, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e,
|
||||
0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x72,
|
||||
0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x72,
|
||||
0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xaa, 0x02, 0x1e, 0x4e, 0x65, 0x6f, 0x2e,
|
||||
0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x50, 0x49, 0x2e,
|
||||
0x52, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -326,27 +393,30 @@ func file_v2_reputation_grpc_types_proto_rawDescGZIP() []byte {
|
|||
return file_v2_reputation_grpc_types_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_v2_reputation_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_v2_reputation_grpc_types_proto_goTypes = []interface{}{
|
||||
(*PeerID)(nil), // 0: neo.fs.v2.reputation.PeerID
|
||||
(*Trust)(nil), // 1: neo.fs.v2.reputation.Trust
|
||||
(*GlobalTrust)(nil), // 2: neo.fs.v2.reputation.GlobalTrust
|
||||
(*GlobalTrust_Body)(nil), // 3: neo.fs.v2.reputation.GlobalTrust.Body
|
||||
(*grpc.Version)(nil), // 4: neo.fs.v2.refs.Version
|
||||
(*grpc.Signature)(nil), // 5: neo.fs.v2.refs.Signature
|
||||
(*PeerToPeerTrust)(nil), // 2: neo.fs.v2.reputation.PeerToPeerTrust
|
||||
(*GlobalTrust)(nil), // 3: neo.fs.v2.reputation.GlobalTrust
|
||||
(*GlobalTrust_Body)(nil), // 4: neo.fs.v2.reputation.GlobalTrust.Body
|
||||
(*grpc.Version)(nil), // 5: neo.fs.v2.refs.Version
|
||||
(*grpc.Signature)(nil), // 6: neo.fs.v2.refs.Signature
|
||||
}
|
||||
var file_v2_reputation_grpc_types_proto_depIdxs = []int32{
|
||||
0, // 0: neo.fs.v2.reputation.Trust.peer:type_name -> neo.fs.v2.reputation.PeerID
|
||||
4, // 1: neo.fs.v2.reputation.GlobalTrust.version:type_name -> neo.fs.v2.refs.Version
|
||||
3, // 2: neo.fs.v2.reputation.GlobalTrust.body:type_name -> neo.fs.v2.reputation.GlobalTrust.Body
|
||||
5, // 3: neo.fs.v2.reputation.GlobalTrust.signature:type_name -> neo.fs.v2.refs.Signature
|
||||
0, // 4: neo.fs.v2.reputation.GlobalTrust.Body.manager:type_name -> neo.fs.v2.reputation.PeerID
|
||||
1, // 5: neo.fs.v2.reputation.GlobalTrust.Body.trust:type_name -> neo.fs.v2.reputation.Trust
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
0, // 1: neo.fs.v2.reputation.PeerToPeerTrust.trusting_peer:type_name -> neo.fs.v2.reputation.PeerID
|
||||
1, // 2: neo.fs.v2.reputation.PeerToPeerTrust.trust:type_name -> neo.fs.v2.reputation.Trust
|
||||
5, // 3: neo.fs.v2.reputation.GlobalTrust.version:type_name -> neo.fs.v2.refs.Version
|
||||
4, // 4: neo.fs.v2.reputation.GlobalTrust.body:type_name -> neo.fs.v2.reputation.GlobalTrust.Body
|
||||
6, // 5: neo.fs.v2.reputation.GlobalTrust.signature:type_name -> neo.fs.v2.refs.Signature
|
||||
0, // 6: neo.fs.v2.reputation.GlobalTrust.Body.manager:type_name -> neo.fs.v2.reputation.PeerID
|
||||
1, // 7: neo.fs.v2.reputation.GlobalTrust.Body.trust:type_name -> neo.fs.v2.reputation.Trust
|
||||
8, // [8:8] is the sub-list for method output_type
|
||||
8, // [8:8] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_v2_reputation_grpc_types_proto_init() }
|
||||
|
@ -380,7 +450,7 @@ func file_v2_reputation_grpc_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_v2_reputation_grpc_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GlobalTrust); i {
|
||||
switch v := v.(*PeerToPeerTrust); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -392,6 +462,18 @@ func file_v2_reputation_grpc_types_proto_init() {
|
|||
}
|
||||
}
|
||||
file_v2_reputation_grpc_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GlobalTrust); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_v2_reputation_grpc_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GlobalTrust_Body); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -410,7 +492,7 @@ func file_v2_reputation_grpc_types_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_v2_reputation_grpc_types_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
@ -21,6 +21,14 @@ func (x *Trust) UnmarshalJSON(data []byte) error {
|
|||
return message.UnmarshalJSON(x, data, new(reputation.Trust))
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) MarshalJSON() ([]byte, error) {
|
||||
return message.MarshalJSON(x)
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) UnmarshalJSON(data []byte) error {
|
||||
return message.UnmarshalJSON(x, data, new(reputation.PeerToPeerTrust))
|
||||
}
|
||||
|
||||
func (x *GlobalTrust) MarshalJSON() ([]byte, error) {
|
||||
return message.MarshalJSON(x)
|
||||
}
|
||||
|
|
|
@ -84,6 +84,45 @@ func (x *Trust) Unmarshal(data []byte) error {
|
|||
return message.Unmarshal(x, data, new(reputation.Trust))
|
||||
}
|
||||
|
||||
const (
|
||||
_ = iota
|
||||
p2pTrustTrustingFNum
|
||||
p2pTrustValueFNum
|
||||
)
|
||||
|
||||
func (x *PeerToPeerTrust) StableMarshal(buf []byte) ([]byte, error) {
|
||||
if x == nil {
|
||||
return []byte{}, nil
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
|
||||
offset, err := protoutil.NestedStructureMarshal(p2pTrustTrustingFNum, buf, x.trusting)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = protoutil.NestedStructureMarshal(p2pTrustValueFNum, buf[offset:], x.trust)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) StableSize() (size int) {
|
||||
size += protoutil.NestedStructureSize(p2pTrustTrustingFNum, x.trusting)
|
||||
size += protoutil.NestedStructureSize(p2pTrustValueFNum, x.trust)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (x *PeerToPeerTrust) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(x, data, new(reputation.PeerToPeerTrust))
|
||||
}
|
||||
|
||||
const (
|
||||
_ = iota
|
||||
globalTrustBodyManagerFNum
|
||||
|
|
|
@ -25,5 +25,6 @@ func TestMessageConvert(t *testing.T) {
|
|||
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) },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -28,6 +28,15 @@ func GenerateTrust(empty bool) *reputation.Trust {
|
|||
return m
|
||||
}
|
||||
|
||||
func GeneratePeerToPeerTrust(empty bool) *reputation.PeerToPeerTrust {
|
||||
m := new(reputation.PeerToPeerTrust)
|
||||
|
||||
m.SetTrustingPeer(GeneratePeerID(empty))
|
||||
m.SetTrust(GenerateTrust(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func GenerateGlobalTrustBody(empty bool) *reputation.GlobalTrustBody {
|
||||
m := new(reputation.GlobalTrustBody)
|
||||
|
||||
|
@ -103,7 +112,7 @@ func GenerateSendIntermediateResultRequestBody(empty bool) *reputation.SendInter
|
|||
m.SetIteration(564)
|
||||
}
|
||||
|
||||
m.SetTrust(GenerateTrust(empty))
|
||||
m.SetTrust(GeneratePeerToPeerTrust(empty))
|
||||
|
||||
return m
|
||||
}
|
||||
|
|
|
@ -67,6 +67,46 @@ func (x *Trust) SetValue(v float64) {
|
|||
}
|
||||
}
|
||||
|
||||
// PeerToPeerTrust represents reputation.PeerToPeerTrust message
|
||||
// from NeoFS API v2.
|
||||
type PeerToPeerTrust struct {
|
||||
trusting *PeerID
|
||||
|
||||
trust *Trust
|
||||
}
|
||||
|
||||
// GetTrustingPeer returns trusting peer ID.
|
||||
func (x *PeerToPeerTrust) GetTrustingPeer() *PeerID {
|
||||
if x != nil {
|
||||
return x.trusting
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetTrustingPeer sets trusting peer ID.
|
||||
func (x *PeerToPeerTrust) SetTrustingPeer(v *PeerID) {
|
||||
if x != nil {
|
||||
x.trusting = v
|
||||
}
|
||||
}
|
||||
|
||||
// GetTrust returns trust value of trusting peer to the trusted one.
|
||||
func (x *PeerToPeerTrust) GetTrust() *Trust {
|
||||
if x != nil {
|
||||
return x.trust
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetTrust sets trust value of trusting peer to the trusted one.
|
||||
func (x *PeerToPeerTrust) SetTrust(v *Trust) {
|
||||
if x != nil {
|
||||
x.trust = v
|
||||
}
|
||||
}
|
||||
|
||||
// GlobalTrustBody represents reputation.GlobalTrust.Body message
|
||||
// from NeoFS API v2.
|
||||
type GlobalTrustBody struct {
|
||||
|
@ -259,7 +299,7 @@ func (x *SendLocalTrustResponse) SetBody(v *SendLocalTrustResponseBody) {
|
|||
type SendIntermediateResultRequestBody struct {
|
||||
iter uint32
|
||||
|
||||
trust *Trust
|
||||
trust *PeerToPeerTrust
|
||||
}
|
||||
|
||||
// GetIteration returns sequence number of the iteration.
|
||||
|
@ -279,7 +319,7 @@ func (x *SendIntermediateResultRequestBody) SetIteration(v uint32) {
|
|||
}
|
||||
|
||||
// GetTrust returns current global trust value.
|
||||
func (x *SendIntermediateResultRequestBody) GetTrust() *Trust {
|
||||
func (x *SendIntermediateResultRequestBody) GetTrust() *PeerToPeerTrust {
|
||||
if x != nil {
|
||||
return x.trust
|
||||
}
|
||||
|
@ -288,7 +328,7 @@ func (x *SendIntermediateResultRequestBody) GetTrust() *Trust {
|
|||
}
|
||||
|
||||
// SetTrust sets current global trust value.
|
||||
func (x *SendIntermediateResultRequestBody) SetTrust(v *Trust) {
|
||||
func (x *SendIntermediateResultRequestBody) SetTrust(v *PeerToPeerTrust) {
|
||||
if x != nil {
|
||||
x.trust = v
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue