satellite/gracefulexit: Add protobuf definitions for communication between storage node and satellite (#3201)

This commit is contained in:
Ethan Adams 2019-10-08 13:42:56 -04:00 committed by GitHub
parent a744fdfef0
commit 447c219d92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1445 additions and 1400 deletions

1006
pkg/pb/gracefulexit.pb.go Normal file

File diff suppressed because it is too large Load Diff

77
pkg/pb/gracefulexit.proto Normal file
View File

@ -0,0 +1,77 @@
// 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;
service SatelliteGracefulExit {
// Process is called by storage nodes to initiate the graceful exit, get pieces to transfer, and receive exit status.
rpc Process(stream StorageNodeMessage) returns (stream SatelliteMessage);
}
message TransferSucceeded {
metainfo.AddressedOrderLimit addressed_order_limit = 1;
orders.PieceHash original_piece_hash = 2;
orders.PieceHash replacement_piece_hash = 3;
}
message TransferFailed {
bytes piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
enum Error {
NOT_FOUND = 0;
STORAGE_NODE_UNAVAILABLE = 1;
UNKNOWN = 2;
}
Error error = 2;
}
message StorageNodeMessage {
oneof Message {
TransferSucceeded succeeded = 1;
TransferFailed failed = 2;
}
}
message NotReady {}
message TransferPiece {
bytes piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false]; // the current piece-id
bytes private_key = 2 [(gogoproto.customtype) = "PiecePrivateKey", (gogoproto.nullable) = false];
// addressed_order_limit contains the new piece id.
metainfo.AddressedOrderLimit addressed_order_limit =3;
}
message DeletePiece {
bytes piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
}
message ExitCompleted {
// when everything is completed
bytes exit_complete_signature = 1;
}
message ExitFailed {
enum Reason {
VERIFICATION_FAILED = 0;
}
// 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;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,6 @@ type (
// IrreparableInspectorClient is an alias to the drpc client interface
IrreparableInspectorClient = pb.DRPCIrreparableInspectorClient
// KadInspectorClient is an alias to the drpc client interface
KadInspectorClient = pb.DRPCKadInspectorClient
// MetainfoClient is an alias to the drpc client interface
MetainfoClient = pb.DRPCMetainfoClient
@ -53,6 +50,9 @@ type (
// PiecestoreClient is an alias to the drpc client interface
PiecestoreClient = pb.DRPCPiecestoreClient
// SatelliteGracefulExitClient is an alias to the drpc client interface
SatelliteGracefulExitClient = pb.DRPCSatelliteGracefulExitClient
// VouchersClient is an alias to the drpc client interface
VouchersClient = pb.DRPCVouchersClient
)
@ -97,16 +97,6 @@ func (c *Conn) IrreparableInspectorClient() IrreparableInspectorClient {
return NewIrreparableInspectorClient(c.raw)
}
// NewKadInspectorClient returns the drpc version of a KadInspectorClient
func NewKadInspectorClient(rc *RawConn) KadInspectorClient {
return pb.NewDRPCKadInspectorClient(rc)
}
// KadInspectorClient returns a KadInspectorClient for this connection
func (c *Conn) KadInspectorClient() KadInspectorClient {
return NewKadInspectorClient(c.raw)
}
// NewMetainfoClient returns the drpc version of a MetainfoClient
func NewMetainfoClient(rc *RawConn) MetainfoClient {
return pb.NewDRPCMetainfoClient(rc)
@ -187,6 +177,16 @@ func (c *Conn) PiecestoreClient() PiecestoreClient {
return NewPiecestoreClient(c.raw)
}
// NewSatelliteGracefulExitClient returns the drpc version of a SatelliteGracefulExitClient
func NewSatelliteGracefulExitClient(rc *RawConn) SatelliteGracefulExitClient {
return pb.NewDRPCSatelliteGracefulExitClient(rc)
}
// SatelliteGracefulExitClient returns a SatelliteGracefulExitClient for this connection
func (c *Conn) SatelliteGracefulExitClient() SatelliteGracefulExitClient {
return NewSatelliteGracefulExitClient(c.raw)
}
// NewVouchersClient returns the drpc version of a VouchersClient
func NewVouchersClient(rc *RawConn) VouchersClient {
return pb.NewDRPCVouchersClient(rc)

View File

@ -27,9 +27,6 @@ type (
// IrreparableInspectorClient is an alias to the grpc client interface
IrreparableInspectorClient = pb.IrreparableInspectorClient
// KadInspectorClient is an alias to the grpc client interface
KadInspectorClient = pb.KadInspectorClient
// MetainfoClient is an alias to the grpc client interface
MetainfoClient = pb.MetainfoClient
@ -54,6 +51,9 @@ type (
// PiecestoreClient is an alias to the grpc client interface
PiecestoreClient = pb.PiecestoreClient
// SatelliteGracefulExitClient is an alias to the grpc client interface
SatelliteGracefulExitClient = pb.SatelliteGracefulExitClient
// VouchersClient is an alias to the grpc client interface
VouchersClient = pb.VouchersClient
)
@ -98,16 +98,6 @@ func (c *Conn) IrreparableInspectorClient() IrreparableInspectorClient {
return NewIrreparableInspectorClient(c.raw)
}
// NewKadInspectorClient returns the grpc version of a KadInspectorClient
func NewKadInspectorClient(rc *RawConn) KadInspectorClient {
return pb.NewKadInspectorClient(rc)
}
// KadInspectorClient returns a KadInspectorClient for this connection
func (c *Conn) KadInspectorClient() KadInspectorClient {
return NewKadInspectorClient(c.raw)
}
// NewMetainfoClient returns the grpc version of a MetainfoClient
func NewMetainfoClient(rc *RawConn) MetainfoClient {
return pb.NewMetainfoClient(rc)
@ -188,6 +178,16 @@ func (c *Conn) PiecestoreClient() PiecestoreClient {
return NewPiecestoreClient(c.raw)
}
// NewSatelliteGracefulExitClient returns the grpc version of a SatelliteGracefulExitClient
func NewSatelliteGracefulExitClient(rc *RawConn) SatelliteGracefulExitClient {
return pb.NewSatelliteGracefulExitClient(rc)
}
// SatelliteGracefulExitClient returns a SatelliteGracefulExitClient for this connection
func (c *Conn) SatelliteGracefulExitClient() SatelliteGracefulExitClient {
return NewSatelliteGracefulExitClient(c.raw)
}
// NewVouchersClient returns the grpc version of a VouchersClient
func NewVouchersClient(rc *RawConn) VouchersClient {
return pb.NewVouchersClient(rc)

View File

@ -847,6 +847,251 @@
]
}
},
{
"protopath": "pkg:/:pb:/:gracefulexit.proto",
"def": {
"enums": [
{
"name": "TransferFailed.Error",
"enum_fields": [
{
"name": "NOT_FOUND"
},
{
"name": "STORAGE_NODE_UNAVAILABLE",
"integer": 1
},
{
"name": "UNKNOWN",
"integer": 2
}
]
},
{
"name": "ExitFailed.Reason",
"enum_fields": [
{
"name": "VERIFICATION_FAILED"
}
]
}
],
"messages": [
{
"name": "TransferSucceeded",
"fields": [
{
"id": 1,
"name": "addressed_order_limit",
"type": "metainfo.AddressedOrderLimit"
},
{
"id": 2,
"name": "original_piece_hash",
"type": "orders.PieceHash"
},
{
"id": 3,
"name": "replacement_piece_hash",
"type": "orders.PieceHash"
}
]
},
{
"name": "TransferFailed",
"fields": [
{
"id": 1,
"name": "piece_id",
"type": "bytes",
"options": [
{
"name": "(gogoproto.customtype)",
"value": "PieceID"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
},
{
"id": 2,
"name": "error",
"type": "Error"
}
]
},
{
"name": "StorageNodeMessage",
"fields": [
{
"id": 1,
"name": "succeeded",
"type": "TransferSucceeded"
},
{
"id": 2,
"name": "failed",
"type": "TransferFailed"
}
]
},
{
"name": "NotReady"
},
{
"name": "TransferPiece",
"fields": [
{
"id": 1,
"name": "piece_id",
"type": "bytes",
"options": [
{
"name": "(gogoproto.customtype)",
"value": "PieceID"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
},
{
"id": 2,
"name": "private_key",
"type": "bytes",
"options": [
{
"name": "(gogoproto.customtype)",
"value": "PiecePrivateKey"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
},
{
"id": 3,
"name": "addressed_order_limit",
"type": "metainfo.AddressedOrderLimit"
}
]
},
{
"name": "DeletePiece",
"fields": [
{
"id": 1,
"name": "piece_id",
"type": "bytes",
"options": [
{
"name": "(gogoproto.customtype)",
"value": "PieceID"
},
{
"name": "(gogoproto.nullable)",
"value": "false"
}
]
}
]
},
{
"name": "ExitCompleted",
"fields": [
{
"id": 1,
"name": "exit_complete_signature",
"type": "bytes"
}
]
},
{
"name": "ExitFailed",
"fields": [
{
"id": 1,
"name": "exit_failure_signature",
"type": "bytes"
},
{
"id": 2,
"name": "reason",
"type": "Reason"
}
]
},
{
"name": "SatelliteMessage",
"fields": [
{
"id": 1,
"name": "not_ready",
"type": "NotReady"
},
{
"id": 2,
"name": "transfer_piece",
"type": "TransferPiece"
},
{
"id": 3,
"name": "delete_piece",
"type": "DeletePiece"
},
{
"id": 4,
"name": "exit_completed",
"type": "ExitCompleted"
},
{
"id": 5,
"name": "exit_failed",
"type": "ExitFailed"
}
]
}
],
"services": [
{
"name": "SatelliteGracefulExit",
"rpcs": [
{
"name": "Process",
"in_type": "StorageNodeMessage",
"out_type": "SatelliteMessage",
"in_streamed": true,
"out_streamed": true
}
]
}
],
"imports": [
{
"path": "gogo.proto"
},
{
"path": "metainfo.proto"
},
{
"path": "orders.proto"
}
],
"package": {
"name": "gracefulexit"
},
"options": [
{
"name": "go_package",
"value": "pb"
}
]
}
},
{
"protopath": "pkg:/:pb:/:inspector.proto",
"def": {