proto/proto/sgx/app.proto

150 lines
3.4 KiB
Protocol Buffer

// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package app_proto;
import "shared/common.proto";
message AppContract {
string app_id = 1;
string package_url = 2;
string admin_pubkey = 3;
string node_pubkey = 4;
string public_ipv4 = 5;
AppResource resource = 6;
repeated common_proto.MappedPort mapped_ports = 7;
string created_at = 8;
string updated_at = 9;
uint64 nano_per_minute = 10;
uint64 locked_nano = 11;
string collected_at = 12;
string hratls_pubkey = 13;
optional bytes public_package_mr_enclave = 14;
string app_name = 15;
}
message NewAppReq {
string package_url = 1;
string node_pubkey = 2;
AppResource resource = 3;
string app_id = 4;
string admin_pubkey = 5;
uint64 price_per_unit = 6;
uint64 locked_nano = 7;
string hratls_pubkey = 8;
optional bytes public_package_mr_enclave = 9;
string app_name = 10;
}
message AppResource {
uint32 memory_mib = 1;
uint32 disk_size_mib = 2;
uint32 vcpus = 3;
repeated uint32 ports = 4;
}
message NewAppRes {
string app_id = 1;
string ip_address = 2;
repeated common_proto.MappedPort mapped_ports = 3;
string error = 4;
}
message DelAppReq {
string app_id = 1;
string admin_pubkey = 2;
}
message ListAppContractsReq {
string admin_pubkey = 1;
bool as_operator = 2;
string app_id = 3;
}
message AppNodeFilters {
uint32 vcpus = 1;
uint32 memory_mib = 2;
uint32 storage_mib = 3;
string country = 4;
string region = 5;
string city = 6;
string ip = 7;
string node_pubkey = 8;
uint32 free_ports = 9;
}
message AppNodeListResp {
string operator = 1;
string node_pubkey = 2;
string country = 3;
string region = 4;
string city = 5;
string ip = 6; // required for latency test
repeated string reports = 7; // TODO: this will become an enum
uint64 price = 8; // nanocredits per unit per minute
uint64 vcpus = 9;
uint64 memory_mib = 10;
uint64 disk_mib = 11;
}
service BrainAppCli {
rpc NewApp (NewAppReq) returns (NewAppRes);
rpc DeleteApp (DelAppReq) returns (common_proto.Empty);
rpc ListAppContracts (ListAppContractsReq) returns (stream AppContract);
rpc ListAppNodes (AppNodeFilters) returns (stream AppNodeListResp);
rpc GetOneAppNode (AppNodeFilters) returns (AppNodeListResp);
// super admin commands
// rpc ListAllAppContracts (common_proto.Empty) returns (stream AppContract);
}
message RegisterAppNodeReq {
string node_pubkey = 1;
string operator_wallet = 2;
string main_ip = 3;
string country = 4;
string region = 5;
string city = 6;
uint64 price = 7;
}
message AppNodeResources {
string node_pubkey = 1;
uint32 avail_no_of_port = 2;
uint32 avail_vcpus = 3;
uint32 avail_memory_mib = 4;
uint32 avail_storage_mib = 5;
uint32 max_ports_per_app = 6;
}
message BrainMessageApp {
oneof Msg {
NewAppReq new_app_req = 1;
DelAppReq delete_app_req = 2;
// resource usage
}
}
message DaemonAuth {
string timestamp = 1;
string pubkey = 2;
repeated string contracts = 3;
string signature = 4;
}
message DaemonMessageApp {
oneof Msg {
DaemonAuth auth = 1;
NewAppRes new_app_res = 2;
AppNodeResources app_node_resources = 3;
}
}
service BrainAppDaemon {
rpc RegisterAppNode (RegisterAppNodeReq) returns (stream DelAppReq);
rpc BrainMessages (DaemonAuth) returns (stream BrainMessageApp);
rpc DaemonMessages (stream DaemonMessageApp) returns (common_proto.Empty);
}