storj/pkg/pb/piecestore.proto
Natalie Villasana c3d3f41d30 removes some SignedMessage use (#1258)
Removes most instances of pb.SignedMessage (there's more to take out but they shouldn't hurt anyone as is).

There used to be places in psserver where a PieceID was hmac'd with the SatelliteID, which was gotten from a SignedMessage. This PR makes it so some functions access the SatelliteID from the Payer Bandwidth Allocation instead.

This requires passing a SatelliteID into psserver functions where they weren't before, so the following proto messages have been changed:

 * PieceId - satellite_id field added
   This is so the psserver.Piece function has access to the SatelliteID when it needs to get the namespaced pieceID.
   This proto message should probably be renamed to PieceRequest, or a new PieceRequest message should be created so this isn't misnamed.

 * PieceDelete - satellite_id field added
   This is so the psserver.Delete function has access to the SatelliteID when receiving a request to Delete.
2019-02-19 23:36:08 -06:00

138 lines
3.9 KiB
Protocol Buffer

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
syntax = "proto3";
option go_package = "pb";
package piecestoreroutes;
import "gogo.proto";
import "google/protobuf/duration.proto";
service PieceStoreRoutes {
rpc Piece(PieceId) returns (PieceSummary) {}
rpc Retrieve(stream PieceRetrieval) returns (stream PieceRetrievalStream) {}
rpc Store(stream PieceStore) returns (PieceStoreSummary) {}
rpc Delete(PieceDelete) returns (PieceDeleteSummary) {}
rpc Stats(StatsReq) returns (StatSummary) {}
rpc Dashboard(DashboardReq) returns (stream DashboardStats) {}
}
enum BandwidthAction {
PUT = 0;
GET = 1;
GET_AUDIT = 2;
GET_REPAIR = 3;
PUT_REPAIR = 4;
}
message PayerBandwidthAllocation { // Payer refers to satellite
bytes satellite_id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; // Satellite Identity
bytes uplink_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; // Uplink Identity
int64 max_size = 3; // Max amount of data the satellite will pay for in bytes
int64 expiration_unix_sec = 4; // Unix timestamp for when data is no longer being paid for
string serial_number = 5; // Unique serial number
BandwidthAction action = 6; // GET or PUT
int64 created_unix_sec = 7; // Unix timestamp for when PayerbandwidthAllocation was created
repeated bytes certs = 8; // Satellite certificate chain
bytes signature = 9; // Proof that the data was signed by the Satellite
}
message RenterBandwidthAllocation { // Renter refers to uplink
PayerBandwidthAllocation payer_allocation = 1 [(gogoproto.nullable) = false]; // Bandwidth Allocation from Satellite
int64 total = 2; // Total Bytes Stored
bytes storage_node_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false]; // Storage Node Identity
repeated bytes certs = 4; // Uplink certificate chain
bytes signature = 5; // Proof that the data was signed by the Uplink
}
message PieceStore {
message PieceData {
// TODO: may want to use customtype and fixed-length byte slice
string id = 1;
int64 expiration_unix_sec = 2;
bytes content = 3;
}
RenterBandwidthAllocation bandwidth_allocation = 1;
PieceData piece_data = 2;
SignedMessage authorization = 3;
}
message PieceId {
// TODO: may want to use customtype and fixed-length byte slice
string id = 1;
SignedMessage authorization = 2;
bytes satellite_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
}
message PieceSummary {
string id = 1;
int64 piece_size = 2;
int64 expiration_unix_sec = 3;
}
message PieceRetrieval {
message PieceData {
// TODO: may want to use customtype and fixed-length byte slice
string id = 1;
int64 piece_size = 2;
int64 offset = 3;
}
RenterBandwidthAllocation bandwidth_allocation = 1;
PieceData piece_data = 2;
SignedMessage authorization = 3;
}
message PieceRetrievalStream {
int64 piece_size = 1;
bytes content = 2;
}
message PieceDelete {
// TODO: may want to use customtype and fixed-length byte slice
string id = 1;
SignedMessage authorization = 3;
bytes satellite_id = 4 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
}
message PieceDeleteSummary {
string message = 1;
}
message PieceStoreSummary {
string message = 1;
int64 total_received = 2;
}
message StatsReq {}
message StatSummary {
int64 used_space = 1;
int64 available_space = 2;
int64 used_bandwidth = 3;
int64 available_bandwidth = 4;
}
message SignedMessage {
bytes data = 1;
bytes signature = 2;
bytes public_key = 3;
}
message DashboardReq { }
message DashboardStats {
string node_id = 1;
int64 node_connections = 2;
string bootstrap_address = 3;
string internal_address = 4;
string external_address = 5;
StatSummary stats = 6;
bool connection = 7;
google.protobuf.Duration uptime = 8;
}