90 lines
2.8 KiB
Protocol Buffer
90 lines
2.8 KiB
Protocol Buffer
// 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";
|
|
import "node.proto";
|
|
|
|
// 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;
|
|
}
|
|
|
|
// OrderLimit is provided by satellite to execute specific action on storage node within some limits
|
|
message OrderLimit {
|
|
// unique serial to avoid replay attacks
|
|
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
|
|
// satellite who issued this order limit allowing orderer to do the specified action
|
|
bytes satellite_id = 2 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
|
|
// 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];
|
|
|
|
// 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;
|
|
|
|
google.protobuf.Timestamp piece_expiration = 8;
|
|
google.protobuf.Timestamp order_expiration = 9;
|
|
|
|
bytes satellite_signature = 10;
|
|
|
|
// 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;
|
|
}
|
|
|
|
// Order is a one step of fullfilling Amount number of bytes from an OrderLimit with SerialNumber
|
|
message Order {
|
|
// serial of the order limit that was signed
|
|
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
|
|
// 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;
|
|
}
|
|
|
|
|
|
service Orders {
|
|
rpc Settlement(stream SettlementRequest) returns (stream SettlementResponse) {}
|
|
}
|
|
|
|
message SettlementRequest {
|
|
OrderLimit limit = 1;
|
|
Order order = 2;
|
|
}
|
|
|
|
message SettlementResponse {
|
|
enum Status {
|
|
INVALID = 0;
|
|
ACCEPTED = 1;
|
|
REJECTED = 2;
|
|
}
|
|
|
|
bytes serial_number = 1 [(gogoproto.customtype) = "SerialNumber", (gogoproto.nullable) = false];
|
|
Status status = 2;
|
|
}
|