seperated non vm related services into general protofile shared common proto for types like Empty rename proto packages top level crate export for convenient imports
192 lines
4.4 KiB
Protocol Buffer
192 lines
4.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
package vm_proto;
|
|
|
|
import "shared/common.proto";
|
|
|
|
message VmContract {
|
|
string uuid = 1;
|
|
string hostname = 2;
|
|
string admin_pubkey = 3;
|
|
string node_pubkey = 4;
|
|
repeated uint32 exposed_ports = 5;
|
|
string public_ipv4 = 6;
|
|
string public_ipv6 = 7;
|
|
uint32 disk_size_gb = 8;
|
|
uint32 vcpus = 9;
|
|
uint32 memory_mb = 10;
|
|
string kernel_sha = 11;
|
|
string dtrfs_sha = 12;
|
|
string created_at = 13;
|
|
string updated_at = 14;
|
|
// total nanoLP cost per minute (for all units)
|
|
uint64 nano_per_minute = 15;
|
|
uint64 locked_nano = 16;
|
|
string collected_at = 17;
|
|
}
|
|
|
|
message MeasurementArgs {
|
|
// this will be IP:Port of the dtrfs API
|
|
// actually not a measurement arg, but needed for the injector
|
|
string dtrfs_api_endpoint = 1;
|
|
repeated uint32 exposed_ports = 2;
|
|
string ovmf_hash = 5;
|
|
// This is needed to allow the CLI to build the kernel params from known data.
|
|
// The CLI will use the kernel params to get the measurement.
|
|
repeated MeasurementIP ips = 6;
|
|
}
|
|
|
|
message MeasurementIP {
|
|
uint32 nic_index = 1;
|
|
string address = 2;
|
|
string mask = 3;
|
|
string gateway = 4;
|
|
}
|
|
|
|
// This should also include a block hash or similar, for auth
|
|
message RegisterVmNodeReq {
|
|
string node_pubkey = 1;
|
|
string operator_wallet = 2;
|
|
string main_ip = 3;
|
|
string country = 4;
|
|
string region = 5;
|
|
string city = 6;
|
|
// nanoLP per unit per minute
|
|
uint64 price = 7;
|
|
}
|
|
|
|
message VmNodeResources {
|
|
string node_pubkey = 1;
|
|
uint32 avail_ports = 2;
|
|
uint32 avail_ipv4 = 3;
|
|
uint32 avail_ipv6 = 4;
|
|
uint32 avail_vcpus = 5;
|
|
uint32 avail_memory_mb = 6;
|
|
uint32 avail_storage_gb = 7;
|
|
uint32 max_ports_per_vm = 8;
|
|
}
|
|
|
|
message NewVmReq {
|
|
string uuid = 1;
|
|
string hostname = 2;
|
|
string admin_pubkey = 3;
|
|
string node_pubkey = 4;
|
|
repeated uint32 extra_ports = 5;
|
|
bool public_ipv4 = 6;
|
|
bool public_ipv6 = 7;
|
|
uint32 disk_size_gb = 8;
|
|
uint32 vcpus = 9;
|
|
uint32 memory_mb = 10;
|
|
string kernel_url = 11;
|
|
string kernel_sha = 12;
|
|
string dtrfs_url = 13;
|
|
string dtrfs_sha = 14;
|
|
uint64 price_per_unit = 15;
|
|
uint64 locked_nano = 16;
|
|
}
|
|
|
|
message NewVmResp {
|
|
string uuid = 1;
|
|
string error = 2;
|
|
MeasurementArgs args = 3;
|
|
}
|
|
|
|
message UpdateVmReq {
|
|
string uuid = 1;
|
|
string admin_pubkey = 2;
|
|
uint32 disk_size_gb = 3;
|
|
uint32 vcpus = 4;
|
|
uint32 memory_mb = 5;
|
|
string kernel_url = 6;
|
|
string kernel_sha = 7;
|
|
string dtrfs_url = 8;
|
|
string dtrfs_sha = 9;
|
|
}
|
|
|
|
message UpdateVmResp {
|
|
string uuid = 1;
|
|
string error = 2;
|
|
MeasurementArgs args = 3;
|
|
}
|
|
|
|
message DeleteVmReq {
|
|
string uuid = 1;
|
|
string admin_pubkey = 2;
|
|
}
|
|
|
|
message BrainVmMessage {
|
|
oneof Msg {
|
|
NewVmReq new_vm_req = 1;
|
|
UpdateVmReq update_vm_req = 2;
|
|
DeleteVmReq delete_vm = 3;
|
|
}
|
|
}
|
|
|
|
message DaemonStreamAuth {
|
|
string timestamp = 1;
|
|
string pubkey = 2;
|
|
repeated string contracts = 3;
|
|
string signature = 4;
|
|
}
|
|
|
|
message VmDaemonMessage {
|
|
oneof Msg {
|
|
DaemonStreamAuth auth = 1;
|
|
NewVmResp new_vm_resp = 2;
|
|
UpdateVmResp update_vm_resp = 3;
|
|
VmNodeResources vm_node_resources = 4;
|
|
}
|
|
}
|
|
|
|
service BrainVmDaemon {
|
|
rpc RegisterVmNode (RegisterVmNodeReq) returns (stream VmContract);
|
|
rpc BrainMessages (DaemonStreamAuth) returns (stream BrainVmMessage);
|
|
rpc DaemonMessages (stream VmDaemonMessage) returns (common_proto.Empty);
|
|
}
|
|
|
|
message ListVmContractsReq {
|
|
string wallet = 1;
|
|
bool as_operator = 2;
|
|
string uuid = 3;
|
|
}
|
|
|
|
message VmNodeFilters {
|
|
uint32 free_ports = 1;
|
|
bool offers_ipv4 = 2;
|
|
bool offers_ipv6 = 3;
|
|
uint32 vcpus = 4;
|
|
uint32 memory_mb = 5;
|
|
uint32 storage_gb = 6;
|
|
string country = 7;
|
|
string region = 8;
|
|
string city = 9;
|
|
string ip = 10;
|
|
string node_pubkey = 11;
|
|
}
|
|
|
|
message VmNodeListResp {
|
|
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; // nanoLP per unit per minute
|
|
}
|
|
|
|
message ExtendVmReq {
|
|
string uuid = 1;
|
|
string admin_pubkey = 2;
|
|
uint64 locked_nano = 3;
|
|
}
|
|
|
|
service BrainVmCli {
|
|
rpc NewVm (NewVmReq) returns (NewVmResp);
|
|
rpc ListVmContracts (ListVmContractsReq) returns (stream VmContract);
|
|
rpc ListVmNodes (VmNodeFilters) returns (stream VmNodeListResp);
|
|
rpc GetOneVmNode (VmNodeFilters) returns (VmNodeListResp);
|
|
rpc DeleteVm (DeleteVmReq) returns (common_proto.Empty);
|
|
rpc UpdateVm (UpdateVmReq) returns (UpdateVmResp);
|
|
rpc ExtendVm (ExtendVmReq) returns (common_proto.Empty);
|
|
}
|