storj/pkg/pb/piecestore.proto
Alexander Leitner 5e9377524f
Refactor basystem (#641)
* Signature verification

* Clean up agreement sender to have less errors

* overlay address in captnplanet

* Refactor bandwidth.proto to not use streams

* Make sure the send worked

* Handle connection to satellite

* Save renter public key inside of renter bandwidth allocations

* Default diag to sqlite. Make configurable

* Separate bw server and dbm; regenerate dbx files

* Make sure test uses protobufs

* Demonstrate creating bandwidth allocations
2018-11-15 14:06:09 -05:00

122 lines
2.9 KiB
Protocol Buffer

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
syntax = "proto3";
option go_package = "pb";
package piecestoreroutes;
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) {}
}
message PayerBandwidthAllocation { // Payer refers to satellite
enum Action {
PUT = 0;
GET = 1;
}
message Data {
bytes satellite_id = 1; // Satellite Identity
bytes uplink_id = 2; // 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
Action action = 6; // GET or PUT
int64 created_unix_sec = 7; // Unix timestamp for when PayerbandwidthAllocation was created
}
bytes signature = 1; // Seralized Data signed by Satellite
bytes data = 2; // Serialization of above Data Struct
}
message RenterBandwidthAllocation { // Renter refers to uplink
message Data {
PayerBandwidthAllocation payer_allocation = 1; // Bandwidth Allocation from Satellite
int64 total = 2; // Total Bytes Stored
bytes storage_node_id = 3; // Storage Node Identity
bytes pub_key = 4; // Renter Public Key // TODO: Take this out. It will be kept in a database on the satellite
}
bytes signature = 1; // Seralized Data signed by Uplink
bytes data = 2; // Serialization of above Data Struct
}
message PieceStore {
message PieceData {
string id = 1;
int64 expiration_unix_sec = 2;
bytes content = 3;
}
RenterBandwidthAllocation bandwidthallocation = 1;
PieceData piecedata = 2;
SignedMessage authorization = 3;
}
message PieceId {
string id = 1;
SignedMessage authorization = 2;
}
message PieceSummary {
string id = 1;
int64 size = 2;
int64 expiration_unix_sec = 3;
}
message PieceRetrieval {
message PieceData {
string id = 1;
int64 size = 2;
int64 offset = 3;
}
RenterBandwidthAllocation bandwidthallocation = 1;
PieceData pieceData = 2;
SignedMessage authorization = 3;
}
message PieceRetrievalStream {
int64 size = 1;
bytes content = 2;
}
message PieceDelete {
string id = 1;
SignedMessage authorization = 3;
}
message PieceDeleteSummary {
string message = 1;
}
message PieceStoreSummary {
string message = 1;
int64 totalReceived = 2;
}
message StatsReq {}
message StatSummary {
int64 usedSpace = 1;
int64 availableSpace = 2;
int64 usedBandwidth = 3;
int64 availableBandwidth = 4;
}
message SignedMessage {
bytes data = 1;
bytes signature = 2;
bytes publicKey = 3;
}