[#143] Add proto definitions of Reputation service

Define `Trust` message structure. Define `ReputationService` service. Add
`SendLocalTrust` RPC to `ReputationService`. Define structures of request
and response messages.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-03-24 13:08:16 +03:00 committed by Alex Vanin
parent 10278f741a
commit b334bada34
2 changed files with 79 additions and 0 deletions

61
reputation/service.proto Normal file
View file

@ -0,0 +1,61 @@
syntax = "proto3";
package neo.fs.v2.reputation;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc;reputation";
option csharp_namespace = "Neo.FileStorage.API.Reputation";
import "reputation/types.proto";
import "session/types.proto";
// `ReputationService` provides mechanisms for exchanging
// trust values within NeoFS Reputation system .
service ReputationService {
// Sends local client trust to any peer from NeoFS network.
rpc SendLocalTrust (SendLocalTrustRequest) returns (SendLocalTrustResponse);
}
// Request to send local trust.
message SendLocalTrustRequest {
// Request body structure.
message Body {
// The number of the epoch in which the trust was assessed.
uint64 epoch = 1;
// List of normalized local trust values of the client to the NeoFS peers.
// The value is calculated according to EigenTrust++ algorithm
// and must be in the range [0;1].
repeated Trust trusts = 2;
}
// Body of the request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.session.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
}
// Response to request to send local trust.
message SendLocalTrustResponse {
// Response body structure.
message Body {
}
// Body of the response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.session.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
}

18
reputation/types.proto Normal file
View file

@ -0,0 +1,18 @@
syntax = "proto3";
package neo.fs.v2.reputation;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc;reputation";
option csharp_namespace = "Neo.FileStorage.API.Reputation";
// Trust value to NeoFS network peer.
message Trust {
// Identifier of the trusted peer.
//
// For storage nodes, it is the node's public key
// fixed in the network map.
bytes peer = 1 [json_name = "peer"];
// Trust value.
double value = 2 [json_name = "value"];
}