2019-10-08 18:42:56 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
option go_package = "pb";
|
|
|
|
|
|
|
|
import "gogo.proto";
|
|
|
|
import "metainfo.proto";
|
|
|
|
import "orders.proto";
|
|
|
|
|
|
|
|
package gracefulexit;
|
|
|
|
|
2019-10-11 14:58:12 +01:00
|
|
|
// NodeGracefulExit is a private service on storagenodes
|
|
|
|
service NodeGracefulExit {
|
2019-10-15 23:07:32 +01:00
|
|
|
// GetSatellitesList returns a list of satellites that the storagenode has not exited.
|
2019-10-11 14:58:12 +01:00
|
|
|
rpc GetNonExitingSatellites(GetNonExitingSatellitesRequest) returns (GetNonExitingSatellitesResponse);
|
2019-10-15 23:07:32 +01:00
|
|
|
// InitiateGracefulExit updates one or more satellites in the storagenode's database to be gracefully exiting.
|
|
|
|
rpc InitiateGracefulExit(InitiateGracefulExitRequest) returns (ExitProgress);
|
|
|
|
// GetExitProgress returns graceful exit status on each satellite for a given storagenode.
|
|
|
|
rpc GetExitProgress(GetExitProgressRequest) returns (GetExitProgressResponse);
|
2019-10-11 14:58:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message GetNonExitingSatellitesRequest{}
|
|
|
|
|
2019-10-15 23:07:32 +01:00
|
|
|
message InitiateGracefulExitRequest {
|
|
|
|
bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
2019-10-11 14:58:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// NonExitingSatellite contains information that's needed for a storagenode to start graceful exit
|
|
|
|
message NonExitingSatellite {
|
2019-10-15 23:07:32 +01:00
|
|
|
bytes node_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
|
|
|
string domain_name = 2;
|
|
|
|
double space_used = 3;
|
2019-10-11 14:58:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message GetNonExitingSatellitesResponse {
|
2019-10-15 23:07:32 +01:00
|
|
|
repeated NonExitingSatellite satellites = 1;
|
2019-10-11 14:58:12 +01:00
|
|
|
}
|
|
|
|
|
2019-10-15 23:07:32 +01:00
|
|
|
message GetExitProgressRequest {}
|
|
|
|
|
|
|
|
message GetExitProgressResponse {
|
|
|
|
repeated ExitProgress progress = 1;
|
2019-10-11 14:58:12 +01:00
|
|
|
}
|
2019-10-15 23:07:32 +01:00
|
|
|
|
|
|
|
message ExitProgress {
|
|
|
|
string domain_name = 1;
|
|
|
|
bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
|
|
|
float percent_complete = 3;
|
|
|
|
bool successful = 4;
|
2019-10-11 14:58:12 +01:00
|
|
|
}
|
|
|
|
|
2019-10-08 18:42:56 +01:00
|
|
|
service SatelliteGracefulExit {
|
2019-10-11 14:58:12 +01:00
|
|
|
// Process is called by storage nodes to initiate the graceful exit, get pieces to transfer, and receive exit status.
|
2019-10-08 18:42:56 +01:00
|
|
|
rpc Process(stream StorageNodeMessage) returns (stream SatelliteMessage);
|
|
|
|
}
|
|
|
|
|
|
|
|
message TransferSucceeded {
|
2019-10-22 21:42:21 +01:00
|
|
|
orders.OrderLimit original_order_limit = 1;
|
2019-10-08 18:42:56 +01:00
|
|
|
orders.PieceHash original_piece_hash = 2;
|
|
|
|
orders.PieceHash replacement_piece_hash = 3;
|
2019-10-15 20:59:12 +01:00
|
|
|
bytes original_piece_id = 4 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
2019-10-08 18:42:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message TransferFailed {
|
2019-10-15 20:59:12 +01:00
|
|
|
bytes original_piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
2019-10-08 18:42:56 +01:00
|
|
|
enum Error {
|
|
|
|
NOT_FOUND = 0;
|
|
|
|
STORAGE_NODE_UNAVAILABLE = 1;
|
2019-10-22 21:42:21 +01:00
|
|
|
HASH_VERIFICATION = 2;
|
|
|
|
|
|
|
|
UNKNOWN = 10;
|
2019-10-08 18:42:56 +01:00
|
|
|
}
|
|
|
|
Error error = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message StorageNodeMessage {
|
|
|
|
oneof Message {
|
|
|
|
TransferSucceeded succeeded = 1;
|
|
|
|
TransferFailed failed = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
message NotReady {}
|
|
|
|
|
|
|
|
message TransferPiece {
|
2019-10-15 20:59:12 +01:00
|
|
|
bytes original_piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
2019-10-08 18:42:56 +01:00
|
|
|
bytes private_key = 2 [(gogoproto.customtype) = "PiecePrivateKey", (gogoproto.nullable) = false];
|
2019-10-11 22:18:05 +01:00
|
|
|
|
2019-10-08 18:42:56 +01:00
|
|
|
// addressed_order_limit contains the new piece id.
|
2019-10-15 23:07:32 +01:00
|
|
|
metainfo.AddressedOrderLimit addressed_order_limit =3;
|
2019-10-08 18:42:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message DeletePiece {
|
2019-10-15 20:59:12 +01:00
|
|
|
bytes original_piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
2019-10-08 18:42:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message ExitCompleted {
|
|
|
|
// when everything is completed
|
|
|
|
bytes exit_complete_signature = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ExitFailed {
|
|
|
|
enum Reason {
|
|
|
|
VERIFICATION_FAILED = 0;
|
2019-10-24 17:24:42 +01:00
|
|
|
INACTIVE_TIMEFRAME_EXCEEDED = 1;
|
|
|
|
OVERALL_FAILURE_PERCENTAGE_EXCEEDED = 2;
|
2019-10-08 18:42:56 +01:00
|
|
|
}
|
|
|
|
// on failure
|
|
|
|
bytes exit_failure_signature = 1;
|
|
|
|
Reason reason = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SatelliteMessage {
|
|
|
|
oneof Message {
|
|
|
|
NotReady not_ready = 1;
|
|
|
|
TransferPiece transfer_piece = 2;
|
|
|
|
DeletePiece delete_piece = 3;
|
|
|
|
ExitCompleted exit_completed = 4;
|
|
|
|
ExitFailed exit_failed = 5;
|
|
|
|
}
|
2019-10-11 14:58:12 +01:00
|
|
|
}
|
|
|
|
|