2018-04-12 02:14:29 +01:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
|
2018-07-26 21:20:02 +01:00
|
|
|
import "google/protobuf/duration.proto";
|
2018-07-19 15:48:08 +01:00
|
|
|
|
|
|
|
package overlay;
|
2018-04-12 02:14:29 +01:00
|
|
|
|
|
|
|
// NodeTransport is an enum of possible transports for the overlay network
|
|
|
|
enum NodeTransport {
|
|
|
|
TCP = 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);
|
|
|
|
// FindStorageNodes finds a list of nodes in the network that meet the specified request parameters
|
|
|
|
rpc FindStorageNodes(FindStorageNodesRequest) returns (FindStorageNodesResponse);
|
|
|
|
}
|
|
|
|
|
2018-07-19 15:48:08 +01:00
|
|
|
service Nodes {
|
|
|
|
rpc Query(QueryRequest) returns (QueryResponse);
|
|
|
|
}
|
|
|
|
|
2018-04-12 02:14:29 +01:00
|
|
|
// 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 {
|
2018-06-19 15:00:15 +01:00
|
|
|
Node node = 1;
|
2018-04-12 02:14:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// FindStorageNodesResponse is is response message for the FindStorageNodes rpc call
|
|
|
|
message FindStorageNodesResponse {
|
2018-06-19 15:00:15 +01:00
|
|
|
repeated Node nodes = 1;
|
2018-04-12 02:14:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// FindStorageNodesRequest is is request message for the FindStorageNodes rpc call
|
|
|
|
message FindStorageNodesRequest {
|
|
|
|
int64 objectSize = 1;
|
|
|
|
google.protobuf.Duration contractLength = 2;
|
|
|
|
OverlayOptions opts = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 maxLatency = 1;
|
|
|
|
NodeRep minReputation = 2; // Not sure what NodeRep is yet.
|
|
|
|
int64 minSpeedKbps = 3;
|
2018-08-03 14:15:52 +01:00
|
|
|
int64 amount = 4;
|
2018-08-01 15:15:38 +01:00
|
|
|
NodeRestrictions restrictions = 5;
|
2018-04-12 02:14:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// NodeRep is the reputation characteristics of a node
|
|
|
|
message NodeRep {}
|
|
|
|
|
2018-08-01 15:15:38 +01:00
|
|
|
// NodeRestrictions contains all relevant data about a nodes ability to store data
|
|
|
|
message NodeRestrictions {
|
|
|
|
int64 freeBandwidth = 1;
|
|
|
|
int64 freeDisk = 2;
|
|
|
|
}
|
|
|
|
|
2018-04-12 02:14:29 +01:00
|
|
|
// Node represents a node in the overlay network
|
|
|
|
message Node {
|
|
|
|
string id = 1;
|
|
|
|
NodeAddress address = 2;
|
2018-08-01 15:15:38 +01:00
|
|
|
NodeType type = 3;
|
|
|
|
NodeRestrictions restrictions = 4;
|
|
|
|
}
|
|
|
|
|
2018-08-17 20:11:46 +01:00
|
|
|
// NodeType is an enum of possible node types
|
2018-08-01 15:15:38 +01:00
|
|
|
enum NodeType {
|
|
|
|
ADMIN = 0;
|
|
|
|
STORAGE = 1;
|
2018-04-12 02:14:29 +01:00
|
|
|
}
|
2018-07-19 15:48:08 +01:00
|
|
|
|
|
|
|
message QueryRequest {
|
|
|
|
overlay.Node sender = 1;
|
|
|
|
overlay.Node receiver = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message QueryResponse {
|
|
|
|
overlay.Node sender = 1;
|
2018-08-01 15:15:38 +01:00
|
|
|
|
2018-07-19 15:48:08 +01:00
|
|
|
repeated overlay.Node response = 2;
|
2018-07-26 21:20:02 +01:00
|
|
|
}
|
2018-08-01 15:15:38 +01:00
|
|
|
|
|
|
|
message Restriction {
|
|
|
|
enum Operator {
|
|
|
|
LT = 0;
|
|
|
|
EQ = 1;
|
|
|
|
GT = 2;
|
|
|
|
LTE = 3;
|
|
|
|
GTE = 4;
|
|
|
|
}
|
|
|
|
enum Operand {
|
|
|
|
freeBandwidth = 0;
|
|
|
|
freeDisk = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
Operator operator = 1;
|
|
|
|
Operand operand = 2;
|
|
|
|
int64 value = 3;
|
|
|
|
}
|