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 orders;
|
|
|
|
|
|
|
|
import "gogo.proto";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
2019-06-21 10:19:52 +01:00
|
|
|
import "node.proto";
|
2019-03-18 10:55:06 +00:00
|
|
|
|
|
|
|
// PieceAction is an enumeration of all possible executed actions on storage node
|
|
|
|
enum PieceAction {
|
|
|
|
INVALID = 0;
|
|
|
|
PUT = 1;
|
|
|
|
GET = 2;
|
|
|
|
GET_AUDIT = 3;
|
|
|
|
GET_REPAIR = 4;
|
|
|
|
PUT_REPAIR = 5;
|
|
|
|
DELETE = 6;
|
|
|
|
}
|
|
|
|
|
2019-07-01 16:54:11 +01:00
|
|
|
// OrderLimit is provided by satellite to execute specific action on storage node within some limits
|
|
|
|
message OrderLimit {
|
2019-03-18 10:55:06 +00:00
|
|
|
// unique serial to avoid replay attacks
|
2019-03-18 13:08:24 +00:00
|
|
|
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
|
2019-03-18 10:55:06 +00:00
|
|
|
// satellite who issued this order limit allowing orderer to do the specified action
|
2019-06-21 10:19:52 +01:00
|
|
|
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
2019-03-18 10:55:06 +00:00
|
|
|
// uplink who requested or whom behalf the order limit to do an action
|
|
|
|
bytes uplink_id = 3 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
|
|
|
// storage node who can reclaim the order limit specified by serial
|
|
|
|
bytes storage_node_id = 4 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
2019-06-21 10:19:52 +01:00
|
|
|
|
2019-03-18 10:55:06 +00:00
|
|
|
// piece which is allowed to be touched
|
|
|
|
bytes piece_id = 5 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
|
|
|
// limit in bytes how much can be changed
|
|
|
|
int64 limit = 6;
|
|
|
|
PieceAction action = 7;
|
2019-06-21 10:19:52 +01:00
|
|
|
|
2019-07-09 22:54:00 +01:00
|
|
|
google.protobuf.Timestamp piece_expiration = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
|
|
|
google.protobuf.Timestamp order_expiration = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
2019-07-02 17:06:12 +01:00
|
|
|
google.protobuf.Timestamp order_creation = 12 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
2019-06-21 10:19:52 +01:00
|
|
|
|
2019-03-18 10:55:06 +00:00
|
|
|
bytes satellite_signature = 10;
|
2019-06-21 10:19:52 +01:00
|
|
|
|
|
|
|
// satellites aren't necessarily discoverable in kademlia. this allows
|
|
|
|
// a storage node to find a satellite and handshake with it to get its key.
|
|
|
|
node.NodeAddress satellite_address = 11;
|
2019-03-18 10:55:06 +00:00
|
|
|
}
|
|
|
|
|
2019-07-01 16:54:11 +01:00
|
|
|
// Order is a one step of fullfilling Amount number of bytes from an OrderLimit with SerialNumber
|
|
|
|
message Order {
|
2019-03-18 10:55:06 +00:00
|
|
|
// serial of the order limit that was signed
|
2019-03-18 13:08:24 +00:00
|
|
|
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
|
2019-03-18 10:55:06 +00:00
|
|
|
// amount to be signed for
|
|
|
|
int64 amount = 2;
|
|
|
|
// signature
|
|
|
|
bytes uplink_signature = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message PieceHash {
|
|
|
|
// piece id
|
|
|
|
bytes piece_id = 1 [(gogoproto.customtype) = "PieceID", (gogoproto.nullable) = false];
|
|
|
|
// hash of the piece that was/is uploaded
|
|
|
|
bytes hash = 2;
|
|
|
|
// signature either satellite or storage node
|
|
|
|
bytes signature = 3;
|
2019-07-03 17:14:37 +01:00
|
|
|
// size of uploaded piece
|
|
|
|
int64 piece_size = 4;
|
|
|
|
// timestamp when upload occur
|
|
|
|
google.protobuf.Timestamp timestamp = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
2019-03-21 13:24:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
service Orders {
|
|
|
|
rpc Settlement(stream SettlementRequest) returns (stream SettlementResponse) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
message SettlementRequest {
|
2019-07-01 16:54:11 +01:00
|
|
|
OrderLimit limit = 1;
|
|
|
|
Order order = 2;
|
2019-03-21 13:24:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message SettlementResponse {
|
|
|
|
enum Status {
|
|
|
|
INVALID = 0;
|
|
|
|
ACCEPTED = 1;
|
|
|
|
REJECTED = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
|
|
|
|
Status status = 2;
|
2019-06-21 10:19:52 +01:00
|
|
|
}
|