144 lines
3.2 KiB
Protocol Buffer
144 lines
3.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package app_proto;
|
|
|
|
import "shared/common.proto";
|
|
|
|
message AppContract {
|
|
string uuid = 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 uuid = 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_mb = 1;
|
|
uint32 disk_size_gb = 2;
|
|
uint32 vcpus = 3;
|
|
repeated uint32 ports = 4;
|
|
}
|
|
|
|
message NewAppRes {
|
|
string uuid = 1;
|
|
string ip_address = 2;
|
|
repeated common_proto.MappedPort mapped_ports = 3;
|
|
string error = 4;
|
|
}
|
|
|
|
|
|
message DelAppReq {
|
|
string uuid= 1;
|
|
string admin_pubkey = 2;
|
|
}
|
|
|
|
message ListAppContractsReq {
|
|
string admin_pubkey = 1;
|
|
bool as_operator = 2;
|
|
string uuid = 3;
|
|
}
|
|
|
|
|
|
message AppNodeFilters {
|
|
uint32 vcpus = 1;
|
|
uint32 memory_mb = 2;
|
|
uint32 storage_mb = 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
|
|
uint64 price = 7; // nanoLP per unit per minute
|
|
repeated string reports = 8; // TODO: this will become an enum
|
|
}
|
|
|
|
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_mb = 4;
|
|
uint32 avail_storage_mb = 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 AppContract);
|
|
rpc BrainMessages (DaemonAuth) returns (stream BrainMessageApp);
|
|
rpc DaemonMessages (stream DaemonMessageApp) returns (common_proto.Empty);
|
|
} |