From d0d4622c52efdf74ed6582fbac23a6159986ade3 Mon Sep 17 00:00:00 2001 From: ghe0 Date: Wed, 23 Apr 2025 02:08:23 +0300 Subject: [PATCH] enhance proto based on new DB capabilities --- build.rs | 12 ++++++++++++ proto/snp/vm.proto | 33 ++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/build.rs b/build.rs index d9e8a0c..1557229 100644 --- a/build.rs +++ b/build.rs @@ -6,6 +6,10 @@ fn main() -> Result<(), Box> { ".vm_proto.VmContract", "#[derive(serde::Serialize, serde::Deserialize)]", ) + .type_attribute( + ".vm_proto.MappedPort", + "#[derive(serde::Serialize, serde::Deserialize)]", + ) .type_attribute( ".app_proto.MappedPort", "#[derive(serde::Serialize, serde::Deserialize)]", @@ -34,6 +38,14 @@ fn main() -> Result<(), Box> { ".vm_proto.VmNodeListResp", "#[derive(serde::Serialize, serde::Deserialize)]", ) + .type_attribute( + ".vm_proto.MeasurementArgs", + "#[derive(serde::Serialize, serde::Deserialize)]", + ) + .type_attribute( + ".vm_proto.MeasurementIP", + "#[derive(serde::Serialize, serde::Deserialize)]", + ) .type_attribute( ".dtpm_proto.FileEntry", "#[derive(serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode)]", diff --git a/proto/snp/vm.proto b/proto/snp/vm.proto index fc88cef..06a09a5 100644 --- a/proto/snp/vm.proto +++ b/proto/snp/vm.proto @@ -3,25 +3,32 @@ package vm_proto; import "shared/common.proto"; +message MappedPort { + uint32 host_port = 1; + uint32 guest_port = 2; +} + 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; + string node_ip = 5; + string location = 6; + repeated MappedPort mapped_ports = 7; + string vm_public_ipv4 = 8; + string vm_public_ipv6 = 9; + uint32 disk_size_gb = 10; + uint32 vcpus = 11; + uint32 memory_mb = 12; + string kernel_sha = 13; + string dtrfs_sha = 14; + string created_at = 15; + string updated_at = 16; // total nanoLP cost per minute (for all units) - uint64 nano_per_minute = 15; - uint64 locked_nano = 16; - string collected_at = 17; + uint64 nano_per_minute = 17; + uint64 locked_nano = 18; + string collected_at = 19; } message MeasurementArgs {