2019-03-18 10:55:06 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
option go_package = "pb";
|
|
|
|
|
|
|
|
package piecestore;
|
|
|
|
|
|
|
|
import "gogo.proto";
|
2019-07-11 21:04:22 +01:00
|
|
|
import "google/protobuf/timestamp.proto";
|
2019-03-18 10:55:06 +00:00
|
|
|
import "orders.proto";
|
|
|
|
|
|
|
|
service Piecestore {
|
|
|
|
rpc Upload(stream PieceUploadRequest) returns (PieceUploadResponse) {}
|
|
|
|
rpc Download(stream PieceDownloadRequest) returns (stream PieceDownloadResponse) {}
|
|
|
|
rpc Delete(PieceDeleteRequest) returns (PieceDeleteResponse) {}
|
2019-07-11 21:04:22 +01:00
|
|
|
rpc Retain(RetainRequest) returns (RetainResponse);
|
2019-03-18 10:55:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Expected order of messages from uplink:
|
|
|
|
// OrderLimit ->
|
|
|
|
// repeated
|
|
|
|
// Order ->
|
|
|
|
// Chunk ->
|
|
|
|
// PieceHash signed by uplink ->
|
|
|
|
// <- PieceHash signed by storage node
|
|
|
|
//
|
|
|
|
message PieceUploadRequest {
|
|
|
|
// first message to show that we are allowed to upload
|
2019-07-01 16:54:11 +01:00
|
|
|
orders.OrderLimit limit = 1;
|
2019-03-18 10:55:06 +00:00
|
|
|
// order for uploading
|
2019-07-01 16:54:11 +01:00
|
|
|
orders.Order order = 2;
|
2019-03-18 10:55:06 +00:00
|
|
|
|
|
|
|
// data message
|
|
|
|
message Chunk {
|
|
|
|
int64 offset = 1;
|
|
|
|
bytes data = 2;
|
|
|
|
}
|
|
|
|
Chunk chunk = 3;
|
|
|
|
// final message
|
|
|
|
orders.PieceHash done = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message PieceUploadResponse {
|
|
|
|
orders.PieceHash done = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Expected order of messages from uplink:
|
|
|
|
// {OrderLimit, Chunk} ->
|
|
|
|
// go repeated
|
|
|
|
// Order -> (async)
|
|
|
|
// go repeated
|
|
|
|
// <- PieceDownloadResponse.Chunk
|
|
|
|
message PieceDownloadRequest {
|
|
|
|
// first message to show that we are allowed to upload
|
2019-07-01 16:54:11 +01:00
|
|
|
orders.OrderLimit limit = 1;
|
2019-03-18 10:55:06 +00:00
|
|
|
// order for downloading
|
2019-07-01 16:54:11 +01:00
|
|
|
orders.Order order = 2;
|
2019-03-18 10:55:06 +00:00
|
|
|
|
|
|
|
// Chunk that we wish to download
|
|
|
|
message Chunk {
|
|
|
|
int64 offset = 1;
|
|
|
|
int64 chunk_size = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// request for the chunk
|
|
|
|
Chunk chunk = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message PieceDownloadResponse {
|
|
|
|
// Chunk response for download request
|
|
|
|
message Chunk {
|
|
|
|
int64 offset = 1;
|
|
|
|
bytes data = 2;
|
|
|
|
}
|
|
|
|
Chunk chunk = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message PieceDeleteRequest {
|
2019-07-01 16:54:11 +01:00
|
|
|
orders.OrderLimit limit = 1;
|
2019-03-18 10:55:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message PieceDeleteResponse {
|
2019-07-11 21:04:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message RetainRequest {
|
|
|
|
google.protobuf.Timestamp creation_date = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
|
|
|
bytes filter = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RetainResponse {
|
|
|
|
}
|