storj/pkg/pb/node.proto
Cameron 4058c29ca4
filter duplicate node IPs (#1890)
* add last_ip field to dbx model node, generate dbx

* add last_ip to node proto, generate pb

* migrate

* resolve address in transport.DialNode, update lastIp in cache.UpdateAddress

* use net.SplitHostPort to isolate host address from port

* define DistinctIPs flag

* add test for GetIP

* select last_ip when querying for nodes

* if distinctIPs flag == true, query for nodes with distinct IPs

* some basic tests

* change last_ip to field 14 in proto

* remove comments

* check err

* change distinctIPs to distinctIP

* exclude IPs from newNodes in query for reputable nodes

* add index on last_ip

* only add to excludedIPs if flag is true

* test half new nodes returns distinct IPs

* fix alignment

* add test

* rework ip filter query, add retry logic, add switch for database driver

* add retry to SelectNewNodes

* change discovery intervals so IPs don't get overwritten

* remove TestGetIP

* edit updating node stats in test

* split exclude into nodeIDs and IPs

* separate non-distinct IP query into other function

* trigger checks

* remove else block
2019-05-22 16:06:27 -04:00

87 lines
2.5 KiB
Protocol Buffer

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
syntax = "proto3";
option go_package = "pb";
package node;
import "gogo.proto";
import "google/protobuf/timestamp.proto";
// TODO move statdb.Update() stuff out of here
// Node represents a node in the overlay network
// Node is info for a updating a single storagenode, used in the Update rpc calls
message Node {
bytes id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
NodeAddress address = 2;
reserved 3 to 13;
string last_ip = 14;
reserved "type", "restrictions", "reputation", "metadata", "latency_list", "audit_success", "is_up", "update_latency", "update_audit_success", "update_uptime", "version";
}
// NodeType is an enum of possible node types
enum NodeType {
INVALID = 0;
SATELLITE = 1;
STORAGE = 2;
UPLINK = 3;
BOOTSTRAP = 4;
}
// NodeAddress contains the information needed to communicate with a node on the network
message NodeAddress {
NodeTransport transport = 1;
string address = 2;
}
// NodeTransport is an enum of possible transports for the overlay network
enum NodeTransport {
TCP_TLS_GRPC = 0;
}
// NodeStats is the reputation characteristics of a node
message NodeStats {
bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; // TODO: remove
int64 latency_90 = 2; // 90th percentile measure of storagenode latency
double audit_success_ratio = 3; // (auditSuccessCount / totalAuditCount)
double uptime_ratio = 4; // (uptimeCount / totalUptimeCheckCount)
int64 audit_count = 5;
int64 audit_success_count = 6;
int64 uptime_count = 7;
int64 uptime_success_count = 8;
google.protobuf.Timestamp last_contact_success = 9;
google.protobuf.Timestamp last_contact_failure = 10;
}
// NodeOperator contains info about the storage node operator
message NodeOperator {
string email = 1;
string wallet = 2;
}
// NodeCapacity contains all relevant data about a nodes ability to store data
message NodeCapacity {
int64 free_bandwidth = 1;
int64 free_disk = 2;
}
// Deprecated: use NodeOperator instead
message NodeMetadata {
string email = 1;
string wallet = 2;
}
// Deprecated: use NodeCapacity instead
message NodeRestrictions {
int64 free_bandwidth = 1;
int64 free_disk = 2;
}
// NodeVersion contains
message NodeVersion {
string version = 1; // must be semver formatted
string commit_hash = 2;
google.protobuf.Timestamp timestamp = 3;
bool release = 4;
}