141 lines
3.2 KiB
Protocol Buffer
141 lines
3.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
package brain;
|
|
|
|
message Empty {
|
|
}
|
|
|
|
message NodePubkey {
|
|
string node_pubkey = 1;
|
|
}
|
|
|
|
message RegisterNodeReq {
|
|
string node_pubkey = 1;
|
|
string owner_pubkey = 2;
|
|
}
|
|
|
|
message NodeResourceReq {
|
|
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; // UUID is empty when CLI sends request; brain sets UUID
|
|
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;
|
|
}
|
|
|
|
message UpdateVMReq {
|
|
string uuid = 1;
|
|
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 = 3;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
message ListVMContractsReq {
|
|
string admin_pubkey = 1;
|
|
string node_pubkey = 2;
|
|
}
|
|
|
|
message NewVmRespIP {
|
|
uint32 nic_index = 1;
|
|
string address = 2;
|
|
string mask = 3;
|
|
string gateway = 4;
|
|
}
|
|
|
|
message NewVMResp {
|
|
string uuid = 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 NewVmRespIP ips = 6;
|
|
string error = 7;
|
|
}
|
|
|
|
message DeleteVMReq {
|
|
string uuid = 1;
|
|
}
|
|
|
|
service BrainDaemonService {
|
|
rpc RegisterNode (RegisterNodeReq) returns (Empty);
|
|
rpc SendNodeResources (stream NodeResourceReq) returns (Empty);
|
|
rpc GetNewVMReqs (NodePubkey) returns (stream NewVMReq);
|
|
rpc SendNewVMResp (stream NewVMResp) returns (Empty);
|
|
rpc GetDeleteVMReq (NodePubkey) returns (stream DeleteVMReq);
|
|
rpc ListVMContracts (ListVMContractsReq) returns (stream VMContract);
|
|
rpc GetUpdateVMReq (NodePubkey) returns (stream UpdateVMReq);
|
|
rpc SendUpdateVMResp (stream UpdateVMResp) returns (Empty);
|
|
}
|
|
|
|
message NodeFilters {
|
|
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;
|
|
}
|
|
|
|
message NodeListResp {
|
|
string node_pubkey = 1;
|
|
string country = 2;
|
|
string region = 3;
|
|
string city = 4;
|
|
string ip = 5; // required for latency test
|
|
uint32 server_rating = 6;
|
|
uint32 provider_rating = 7;
|
|
}
|
|
|
|
service BrainCliService {
|
|
rpc CreateVMContract (NewVMReq) returns (NewVMResp);
|
|
rpc ListVMContracts (ListVMContractsReq) returns (stream VMContract);
|
|
rpc ListNodes (NodeFilters) returns (stream NodeListResp);
|
|
rpc DeleteVM (DeleteVMReq) returns (Empty);
|
|
rpc UpdateVM (UpdateVMReq) returns (UpdateVMResp);
|
|
}
|