5014a785a0
* remove api key from statdb server reqs; add statdb UpdateUptime and UpdateAuditSuccess to server * update api key authentication in statdb server * add todos for future statdb updates * add UpdateUptime and UpdateAuditSuccess to statdb server * fix apikey stuff in config.go and statdb_test.go * fix tests * update sdbclient.NewClient call in audit package * fix UpdateUptime and UpdateAuditSuccess in sdbclient * set api key from statdb/config.go * change package for statdb tests * linter fixes * remove todo comments * fix sdbclient err checking * move validate auth functionality to auth package * update description for statdb api key * remove import
133 lines
4.2 KiB
Protocol Buffer
133 lines
4.2 KiB
Protocol Buffer
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
syntax = "proto3";
|
|
package statdb;
|
|
|
|
// StatDB defines the interface for retrieving and updating storagenode stats
|
|
service StatDB {
|
|
// Create a db entry for the provided storagenode ID
|
|
rpc Create(CreateRequest) returns (CreateResponse);
|
|
// Get uses a storagenode ID to get that storagenode's stats
|
|
rpc Get(GetRequest) returns (GetResponse);
|
|
// FindValidNodes gets a subset of storagenodes that fit minimum reputation args
|
|
rpc FindValidNodes(FindValidNodesRequest) returns (FindValidNodesResponse);
|
|
// Update updates all stats for a single storagenode
|
|
rpc Update(UpdateRequest) returns (UpdateResponse);
|
|
// UpdateUptime updates uptime stats for a single storagenode
|
|
rpc UpdateUptime(UpdateUptimeRequest) returns (UpdateUptimeResponse);
|
|
// UpdateAuditSuccess updates audit success stats for a single storagenode
|
|
rpc UpdateAuditSuccess(UpdateAuditSuccessRequest) returns (UpdateAuditSuccessResponse);
|
|
// UpdateBatch updates storagenode stats for multiple farmers at a time
|
|
rpc UpdateBatch(UpdateBatchRequest) returns (UpdateBatchResponse);
|
|
// CreateEntryIfNotExists creates a db entry if it didn't exist
|
|
rpc CreateEntryIfNotExists(CreateEntryIfNotExistsRequest) returns (CreateEntryIfNotExistsResponse);
|
|
}
|
|
|
|
// Node is info for a updating a single storagenode, used in the Update rpc calls
|
|
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;
|
|
}
|
|
|
|
// NodeStats is info about a single storagenode stored in the stats db
|
|
message NodeStats {
|
|
bytes node_id = 1;
|
|
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;
|
|
}
|
|
|
|
// CreateRequest is a request message for the Create rpc call
|
|
message CreateRequest {
|
|
Node node = 1;
|
|
NodeStats stats = 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;
|
|
}
|
|
|
|
// GetResponse is a response message for the Get rpc call
|
|
message GetResponse {
|
|
NodeStats stats = 1;
|
|
}
|
|
|
|
// FindValidNodesRequest is a request message for the FindValidNodes rpc call
|
|
message FindValidNodesRequest {
|
|
repeated bytes node_ids = 1;
|
|
NodeStats min_stats = 2;
|
|
}
|
|
|
|
// FindValidNodesResponse is a response message for the FindValidNodes rpc call
|
|
message FindValidNodesResponse {
|
|
repeated bytes passed_ids = 1;
|
|
repeated bytes failed_ids = 2;
|
|
}
|
|
|
|
// UpdateRequest is a request message for the Update rpc call
|
|
message UpdateRequest {
|
|
Node node = 1;
|
|
}
|
|
|
|
// UpdateRequest is a response message for the Update rpc call
|
|
message UpdateResponse {
|
|
NodeStats stats = 1;
|
|
}
|
|
|
|
// UpdateUptimeRequest is a request message for the UpdateUptime rpc call
|
|
message UpdateUptimeRequest {
|
|
Node node = 1;
|
|
}
|
|
|
|
// UpdateUptimeResponse is a response message for the UpdateUptime rpc call
|
|
message UpdateUptimeResponse {
|
|
NodeStats stats = 1;
|
|
}
|
|
|
|
// UpdateAuditSuccessRequest is a request message for the UpdateAuditSuccess rpc call
|
|
message UpdateAuditSuccessRequest {
|
|
Node node = 1;
|
|
}
|
|
|
|
// UpdateAuditSuccessResponse is a response message for the UpdateAuditSuccess rpc call
|
|
message UpdateAuditSuccessResponse {
|
|
NodeStats stats = 1;
|
|
}
|
|
|
|
// UpdateBatchRequest is a request message for the UpdateBatch rpc call
|
|
message UpdateBatchRequest {
|
|
repeated Node node_list = 1;
|
|
}
|
|
|
|
// UpdateBatchResponse is a response message for the UpdateBatch rpc call
|
|
message UpdateBatchResponse {
|
|
repeated NodeStats stats_list = 1;
|
|
repeated Node failed_nodes = 2;
|
|
}
|
|
|
|
// CreateEntryIfNotExistsRequest is a request message for the CreateEntryIfNotExists rpc call
|
|
message CreateEntryIfNotExistsRequest {
|
|
Node node = 1;
|
|
}
|
|
|
|
// CreateEntryIfNotExistsResponse is a response message for the CreateEntryIfNotExists rpc call
|
|
message CreateEntryIfNotExistsResponse {
|
|
NodeStats stats = 1;
|
|
}
|