storj/pkg/pb/overlay.proto
Maximillian von Briesen 7cf16503b8
Add statdb to overlay cache (node selection) (#711)
* make overlay node rep consistent with statdb node rep

* add statdb to testplanet

* add statdb to overlay cache

* tests
2018-11-27 12:46:12 -05:00

149 lines
3.6 KiB
Protocol Buffer

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
syntax = "proto3";
option go_package = "pb";
import "google/protobuf/duration.proto";
package overlay;
// NodeTransport is an enum of possible transports for the overlay network
enum NodeTransport {
TCP_TLS_GRPC = 0;
}
// Overlay defines the interface for communication with the overlay network
service Overlay {
// Lookup finds a nodes address from the network
rpc Lookup(LookupRequest) returns (LookupResponse);
// BulkLookup finds nodes addresses from the network
rpc BulkLookup(LookupRequests) returns (LookupResponses);
// FindStorageNodes finds a list of nodes in the network that meet the specified request parameters
rpc FindStorageNodes(FindStorageNodesRequest) returns (FindStorageNodesResponse);
}
service Nodes {
rpc Query(QueryRequest) returns (QueryResponse);
rpc Ping(PingRequest) returns (PingResponse);
}
// LookupRequest is is request message for the lookup rpc call
message LookupRequest {
string nodeID = 1;
}
// LookupResponse is is response message for the lookup rpc call
message LookupResponse {
Node node = 1;
}
//LookupRequests is a list of LookupRequest
message LookupRequests {
repeated LookupRequest lookup_request = 1;
}
//LookupResponse is a list of LookupResponse
message LookupResponses {
repeated LookupResponse lookup_response = 1;
}
// FindStorageNodesResponse is is response message for the FindStorageNodes rpc call
message FindStorageNodesResponse {
repeated Node nodes = 1;
}
// FindStorageNodesRequest is is request message for the FindStorageNodes rpc call
message FindStorageNodesRequest {
int64 object_size = 1;
google.protobuf.Duration contract_length = 2;
OverlayOptions opts = 3;
bytes start = 4;
int64 max_nodes = 5;
}
// NodeAddress contains the information needed to communicate with a node on the network
message NodeAddress {
NodeTransport transport = 1;
string address = 2;
}
// OverlayOptions is a set of criteria that a node must meet to be considered for a storage opportunity
message OverlayOptions {
google.protobuf.Duration max_latency = 1;
NodeRep min_reputation = 2;
int64 min_speed_kbps = 3;
int64 amount = 4;
NodeRestrictions restrictions = 5;
repeated string excluded_nodes = 6;
}
// NodeRep is the reputation characteristics of a node
message NodeRep {
double uptimeRatio = 1;
double auditSuccessRatio = 2;
int64 auditCount = 3;
}
// NodeRestrictions contains all relevant data about a nodes ability to store data
message NodeRestrictions {
int64 free_bandwidth = 1;
int64 free_disk = 2;
}
// Node represents a node in the overlay network
message Node {
string id = 1;
NodeAddress address = 2;
NodeType type = 3;
NodeRestrictions restrictions = 4;
NodeMetadata metadata = 5;
NodeRep reputation = 6;
}
// NodeType is an enum of possible node types
enum NodeType {
ADMIN = 0;
STORAGE = 1;
}
message NodeMetadata {
string email = 1;
string wallet = 2;
}
message QueryRequest {
overlay.Node sender = 1;
overlay.Node target = 2;
int64 limit = 3;
bool pingback = 4;
}
message QueryResponse {
overlay.Node sender = 1;
repeated overlay.Node response = 2;
}
message PingRequest {};
message PingResponse {};
message Restriction {
enum Operator {
LT = 0;
EQ = 1;
GT = 2;
LTE = 3;
GTE = 4;
}
enum Operand {
FREE_BANDWIDTH = 0;
FREE_DISK = 1;
}
Operator operator = 1;
Operand operand = 2;
int64 value = 3;
}