2018-07-27 22:11:44 +01:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
package statdb;
|
|
|
|
|
2018-08-25 02:52:58 +01:00
|
|
|
// StatDB defines the interface for retrieving and updating storagenode stats
|
2018-07-27 22:11:44 +01:00
|
|
|
service StatDB {
|
2018-08-25 02:52:58 +01:00
|
|
|
// Create a db entry for the provided storagenode ID
|
2018-07-27 22:11:44 +01:00
|
|
|
rpc Create(CreateRequest) returns (CreateResponse);
|
2018-08-25 02:52:58 +01:00
|
|
|
// Get uses a storagenode ID to get that storagenode's stats
|
2018-07-27 22:11:44 +01:00
|
|
|
rpc Get(GetRequest) returns (GetResponse);
|
2018-10-30 17:11:22 +00:00
|
|
|
// FindValidNodes gets a subset of storagenodes that fit minimum reputation args
|
|
|
|
rpc FindValidNodes(FindValidNodesRequest) returns (FindValidNodesResponse);
|
2018-08-25 02:52:58 +01:00
|
|
|
// Update updates storagenode stats for a single storagenode
|
2018-07-27 22:11:44 +01:00
|
|
|
rpc Update(UpdateRequest) returns (UpdateResponse);
|
2018-08-25 02:52:58 +01:00
|
|
|
// UpdateBatch updates storagenode stats for multiple farmers at a time
|
2018-07-27 22:11:44 +01:00
|
|
|
rpc UpdateBatch(UpdateBatchRequest) returns (UpdateBatchResponse);
|
2018-10-16 18:40:34 +01:00
|
|
|
// CreateEntryIfNotExists creates a db entry if it didn't exist
|
|
|
|
rpc CreateEntryIfNotExists(CreateEntryIfNotExistsRequest) returns (CreateEntryIfNotExistsResponse);
|
2018-07-27 22:11:44 +01:00
|
|
|
}
|
|
|
|
|
2018-08-25 02:52:58 +01:00
|
|
|
// Node is info for a updating a single storagenode, used in the Update rpc calls
|
2018-07-27 22:11:44 +01:00
|
|
|
message Node {
|
|
|
|
bytes node_id = 1;
|
|
|
|
repeated int64 latency_list = 2;
|
|
|
|
bool audit_success = 3;
|
|
|
|
bool is_up = 4;
|
|
|
|
bool update_latency = 5;
|
|
|
|
bool update_audit_success = 6;
|
|
|
|
bool update_uptime = 7;
|
|
|
|
}
|
|
|
|
|
2018-08-25 02:52:58 +01:00
|
|
|
// NodeStats is info about a single storagenode stored in the stats db
|
2018-07-27 22:11:44 +01:00
|
|
|
message NodeStats {
|
|
|
|
bytes node_id = 1;
|
2018-08-25 02:52:58 +01:00
|
|
|
int64 latency_90 = 2; // 90th percentile measure of storagenode latency
|
2018-07-27 22:11:44 +01:00
|
|
|
double audit_success_ratio = 3; // (auditSuccessCount / totalAuditCount)
|
|
|
|
double uptime_ratio = 4; // (uptimeCount / totalUptimeCheckCount)
|
2018-10-30 17:11:22 +00:00
|
|
|
int64 audit_count = 5; // used for FindValidNodes
|
2018-07-27 22:11:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateRequest is a request message for the Create rpc call
|
|
|
|
message CreateRequest {
|
|
|
|
Node node = 1;
|
|
|
|
bytes APIKey = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateResponse is a response message for the Create rpc call
|
|
|
|
message CreateResponse {
|
|
|
|
NodeStats stats = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetRequest is a request message for the Get rpc call
|
|
|
|
message GetRequest {
|
|
|
|
bytes node_id = 1;
|
|
|
|
bytes APIKey = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetResponse is a response message for the Get rpc call
|
|
|
|
message GetResponse {
|
|
|
|
NodeStats stats = 1;
|
|
|
|
}
|
|
|
|
|
2018-10-30 17:11:22 +00:00
|
|
|
// FindValidNodesRequest is a request message for the FindValidNodes rpc call
|
|
|
|
message FindValidNodesRequest {
|
|
|
|
repeated bytes node_ids = 1;
|
|
|
|
NodeStats min_stats = 2;
|
|
|
|
bytes APIKey = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FindValidNodesResponse is a response message for the FindValidNodes rpc call
|
|
|
|
message FindValidNodesResponse {
|
|
|
|
repeated bytes passed_ids = 1;
|
|
|
|
repeated bytes failed_ids = 2;
|
|
|
|
}
|
|
|
|
|
2018-07-27 22:11:44 +01:00
|
|
|
// UpdateRequest is a request message for the Update rpc call
|
|
|
|
message UpdateRequest {
|
|
|
|
Node node = 1;
|
|
|
|
bytes APIKey = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// UpdateRequest is a response message for the Update rpc call
|
|
|
|
message UpdateResponse {
|
|
|
|
NodeStats stats = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// UpdateBatchRequest is a request message for the UpdateBatch rpc call
|
|
|
|
message UpdateBatchRequest {
|
|
|
|
repeated Node node_list = 1;
|
|
|
|
bytes APIKey = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// UpdateBatchResponse is a response message for the UpdateBatch rpc call
|
|
|
|
message UpdateBatchResponse {
|
|
|
|
repeated NodeStats stats_list = 1;
|
2018-10-16 18:40:34 +01:00
|
|
|
repeated Node failed_nodes = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateEntryIfNotExistsRequest is a request message for the CreateEntryIfNotExists rpc call
|
|
|
|
message CreateEntryIfNotExistsRequest {
|
|
|
|
Node node = 1;
|
|
|
|
bytes APIKey = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateEntryIfNotExistsResponse is a response message for the CreateEntryIfNotExists rpc call
|
|
|
|
message CreateEntryIfNotExistsResponse {
|
|
|
|
NodeStats stats = 1;
|
2018-07-27 22:11:44 +01:00
|
|
|
}
|