2018-05-15 01:31:26 +01:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
2018-09-21 19:48:54 +01:00
|
|
|
option go_package = "pb";
|
|
|
|
|
|
|
|
package pointerdb;
|
2018-05-15 01:31:26 +01:00
|
|
|
|
2018-07-26 21:20:02 +01:00
|
|
|
import "google/protobuf/timestamp.proto";
|
2018-11-29 18:39:27 +00:00
|
|
|
import "gogo.proto";
|
|
|
|
import "node.proto";
|
2018-10-30 16:24:46 +00:00
|
|
|
import "piecestore.proto";
|
2018-05-30 03:47:40 +01:00
|
|
|
|
2018-07-06 20:43:53 +01:00
|
|
|
// PointerDB defines the interface for interacting with the network state persistence layer
|
|
|
|
service PointerDB {
|
2018-05-15 01:31:26 +01:00
|
|
|
// Put formats and hands off a file path to be saved to boltdb
|
2018-05-30 03:47:40 +01:00
|
|
|
rpc Put(PutRequest) returns (PutResponse);
|
2018-05-15 01:31:26 +01:00
|
|
|
// Get formats and hands off a file path to get a small value from boltdb
|
|
|
|
rpc Get(GetRequest) returns (GetResponse);
|
|
|
|
// List calls the bolt client's List function and returns all file paths
|
|
|
|
rpc List(ListRequest) returns (ListResponse);
|
|
|
|
// Delete formats and hands off a file path to delete from boltdb
|
|
|
|
rpc Delete(DeleteRequest) returns (DeleteResponse);
|
2018-11-26 18:21:44 +00:00
|
|
|
// PayerBandwidthAllocation returns signed payer bandwidth allocation struct
|
|
|
|
rpc PayerBandwidthAllocation(PayerBandwidthAllocationRequest) returns (PayerBandwidthAllocationResponse);
|
2018-05-15 01:31:26 +01:00
|
|
|
}
|
|
|
|
|
2018-05-30 03:47:40 +01:00
|
|
|
message RedundancyScheme {
|
|
|
|
enum SchemeType {
|
|
|
|
RS = 0;
|
|
|
|
}
|
|
|
|
SchemeType type = 1;
|
|
|
|
|
|
|
|
// these values apply to RS encoding
|
2018-07-27 07:02:59 +01:00
|
|
|
int32 min_req = 2; // minimum required for reconstruction
|
|
|
|
int32 total = 3; // total amount of pieces we generated
|
|
|
|
int32 repair_threshold = 4; // amount of pieces we need to drop to before triggering repair
|
|
|
|
int32 success_threshold = 5; // amount of pieces we need to store to call it a success
|
2018-08-14 16:15:22 +01:00
|
|
|
|
|
|
|
int32 erasure_share_size = 6;
|
2018-05-30 03:47:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message RemotePiece {
|
2018-07-27 07:02:59 +01:00
|
|
|
int32 piece_num = 1;
|
2018-11-29 18:39:27 +00:00
|
|
|
bytes node_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
2018-05-30 03:47:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message RemoteSegment {
|
|
|
|
RedundancyScheme redundancy = 1;
|
2018-11-29 18:39:27 +00:00
|
|
|
// TODO: may want to use customtype and fixed-length byte slice
|
2018-06-13 19:10:16 +01:00
|
|
|
string piece_id = 2;
|
2018-05-30 03:47:40 +01:00
|
|
|
repeated RemotePiece remote_pieces = 3;
|
|
|
|
|
|
|
|
bytes merkle_root = 4; // root hash of the hashes of all of these pieces
|
|
|
|
}
|
|
|
|
|
|
|
|
message Pointer {
|
|
|
|
enum DataType {
|
|
|
|
INLINE = 0;
|
|
|
|
REMOTE = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataType type = 1;
|
|
|
|
|
|
|
|
bytes inline_segment = 3;
|
|
|
|
RemoteSegment remote = 4;
|
2018-11-29 18:39:27 +00:00
|
|
|
// TODO: rename
|
2018-11-20 17:09:35 +00:00
|
|
|
int64 segment_size = 5;
|
2018-05-30 03:47:40 +01:00
|
|
|
|
|
|
|
google.protobuf.Timestamp creation_date = 6;
|
|
|
|
google.protobuf.Timestamp expiration_date = 7;
|
2018-06-26 16:18:05 +01:00
|
|
|
|
|
|
|
bytes metadata = 8;
|
2018-05-30 03:47:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// PutRequest is a request message for the Put rpc call
|
|
|
|
message PutRequest {
|
2018-07-27 07:02:59 +01:00
|
|
|
string path = 1;
|
2018-05-30 03:47:40 +01:00
|
|
|
Pointer pointer = 2;
|
2018-05-15 01:31:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetRequest is a request message for the Get rpc call
|
|
|
|
message GetRequest {
|
2018-07-27 07:02:59 +01:00
|
|
|
string path = 1;
|
2018-05-15 01:31:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ListRequest is a request message for the List rpc call
|
|
|
|
message ListRequest {
|
2018-07-27 07:02:59 +01:00
|
|
|
string prefix = 1;
|
|
|
|
string start_after = 2;
|
|
|
|
string end_before = 3;
|
|
|
|
bool recursive = 4;
|
|
|
|
int32 limit = 5;
|
2018-07-30 19:57:50 +01:00
|
|
|
fixed32 meta_flags = 6;
|
2018-05-15 01:31:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// PutResponse is a response message for the Put rpc call
|
|
|
|
message PutResponse {
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetResponse is a response message for the Get rpc call
|
|
|
|
message GetResponse {
|
2018-10-04 22:00:19 +01:00
|
|
|
Pointer pointer = 1;
|
2018-11-29 18:39:27 +00:00
|
|
|
repeated node.Node nodes = 2;
|
2018-10-30 16:24:46 +00:00
|
|
|
piecestoreroutes.PayerBandwidthAllocation pba = 3;
|
2018-11-05 15:12:19 +00:00
|
|
|
piecestoreroutes.SignedMessage authorization = 4;
|
2018-05-15 01:31:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ListResponse is a response message for the List rpc call
|
|
|
|
message ListResponse {
|
2018-07-27 07:02:59 +01:00
|
|
|
message Item {
|
2018-09-07 15:20:15 +01:00
|
|
|
string path = 1;
|
2018-07-30 19:57:50 +01:00
|
|
|
Pointer pointer = 2;
|
2018-09-07 15:20:15 +01:00
|
|
|
bool is_prefix = 3;
|
2018-07-27 07:02:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
repeated Item items = 1;
|
|
|
|
bool more = 2;
|
2018-05-15 01:31:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteRequest {
|
2018-07-27 07:02:59 +01:00
|
|
|
string path = 1;
|
2018-05-15 01:31:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteResponse is a response message for the Delete rpc call
|
|
|
|
message DeleteResponse {
|
|
|
|
}
|
2018-10-09 17:09:33 +01:00
|
|
|
|
|
|
|
// IterateRequest is a request message for the Iterate rpc call
|
|
|
|
message IterateRequest {
|
|
|
|
string prefix = 1;
|
|
|
|
string first = 2;
|
|
|
|
bool recurse = 3;
|
|
|
|
bool reverse = 4;
|
2018-11-26 18:21:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message PayerBandwidthAllocationRequest {
|
|
|
|
piecestoreroutes.PayerBandwidthAllocation.Action action = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message PayerBandwidthAllocationResponse {
|
|
|
|
piecestoreroutes.PayerBandwidthAllocation pba = 1;
|
2018-10-09 17:09:33 +01:00
|
|
|
}
|