diff --git a/Cargo.lock b/Cargo.lock index fb59c92..64cf995 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,6 @@ -# SPDX-License-Identifier: Apache-2.0 - # This file is automatically @generated by Cargo. # It is not intended for manual editing. +# SPDX-License-Identifier: Apache-2.0 version = 4 [[package]] diff --git a/build.rs b/build.rs index 2946654..30911fd 100644 --- a/build.rs +++ b/build.rs @@ -40,6 +40,10 @@ fn main() -> Result<(), Box> { ".vm_proto.MeasurementArgs", "#[derive(serde::Serialize, serde::Deserialize)]", ) + .type_attribute( + ".vm_proto.NewVmResp", + "#[derive(serde::Serialize, serde::Deserialize)]", + ) .type_attribute( ".vm_proto.MeasurementIP", "#[derive(serde::Serialize, serde::Deserialize)]", diff --git a/proto/sgx/app.proto b/proto/sgx/app.proto index 5a670f4..972b10d 100644 --- a/proto/sgx/app.proto +++ b/proto/sgx/app.proto @@ -83,7 +83,11 @@ message AppNodeListResp { string region = 4; string city = 5; string ip = 6; // required for latency test - uint64 price = 7; // nanoLP per unit per minute + // TODO: understand slot size for apps + // Since apps allow granular tweaking of resources (half a CPU), + // the slot size will be a float, not an int. This makes calculations more complex. + // We should discuss this when we have time. + uint64 price = 7; // nanocredits per slot per month repeated string reports = 8; // TODO: this will become an enum } @@ -143,4 +147,4 @@ service BrainAppDaemon { rpc RegisterAppNode (RegisterAppNodeReq) returns (stream DelAppReq); rpc BrainMessages (DaemonAuth) returns (stream BrainMessageApp); rpc DaemonMessages (stream DaemonMessageApp) returns (common_proto.Empty); -} \ No newline at end of file +} diff --git a/proto/shared/general.proto b/proto/shared/general.proto index 8bc0153..93a94c5 100644 --- a/proto/shared/general.proto +++ b/proto/shared/general.proto @@ -47,7 +47,7 @@ message KickReq { } message KickResp { - uint64 nano_lp = 1; + uint64 nano_credits = 1; } message BanUserReq { @@ -90,4 +90,4 @@ service BrainGeneralCli { returns (stream vm_proto.VmContract); rpc ListAllAppContracts (common_proto.Empty) returns (stream app_proto.AppContract); -} \ No newline at end of file +} diff --git a/proto/snp/vm.proto b/proto/snp/vm.proto index 7531e82..0b1a500 100644 --- a/proto/snp/vm.proto +++ b/proto/snp/vm.proto @@ -15,14 +15,14 @@ message VmContract { repeated common_proto.MappedPort mapped_ports = 7; string vm_public_ipv4 = 8; string vm_public_ipv6 = 9; - uint32 disk_size_gb = 10; + uint32 disk_mib = 10; uint32 vcpus = 11; - uint32 memory_mb = 12; + uint32 memory_mib = 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) + // total nanocredits cost per minute (for all slots) uint64 nano_per_minute = 17; uint64 locked_nano = 18; string collected_at = 19; @@ -54,8 +54,8 @@ message RegisterVmNodeReq { string country = 4; string region = 5; string city = 6; - // nanoLP per unit per minute - uint64 price = 7; + // nanocredits per slot per month + uint64 price_per_slot = 7; } message VmNodeResources { @@ -64,8 +64,8 @@ message VmNodeResources { uint32 avail_ipv4 = 3; uint32 avail_ipv6 = 4; uint32 avail_vcpus = 5; - uint32 avail_memory_mb = 6; - uint32 avail_storage_gb = 7; + uint32 avail_memory_mib = 6; + uint32 avail_storage_mib = 7; uint32 max_ports_per_vm = 8; } @@ -77,30 +77,33 @@ message NewVmReq { 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; + uint32 vcpus = 8; + uint32 memory_mib = 9; + uint32 disk_mib = 10; string kernel_url = 11; string kernel_sha = 12; string dtrfs_url = 13; string dtrfs_sha = 14; - uint64 price_per_unit = 15; + uint64 price_per_slot = 15; uint64 locked_nano = 16; } message NewVmResp { string uuid = 1; string error = 2; - MeasurementArgs args = 3; + uint32 vcpus = 3; + uint32 memory_mib = 4; + uint32 disk_mib = 5; + MeasurementArgs args = 6; } message UpdateVmReq { string uuid = 1; string hostname = 2; string admin_pubkey = 3; - uint32 disk_size_gb = 4; - uint32 vcpus = 5; - uint32 memory_mb = 6; + uint32 vcpus = 4; + uint32 memory_mib = 5; + uint32 disk_mib = 6; string kernel_url = 7; string kernel_sha = 8; string dtrfs_url = 9; @@ -110,7 +113,10 @@ message UpdateVmReq { message UpdateVmResp { string uuid = 1; string error = 2; - MeasurementArgs args = 3; + uint32 vcpus = 3; + uint32 memory_mib = 4; + uint32 disk_mib = 5; + MeasurementArgs args = 6; } message DeleteVmReq { @@ -159,8 +165,8 @@ message VmNodeFilters { bool offers_ipv4 = 2; bool offers_ipv6 = 3; uint32 vcpus = 4; - uint32 memory_mb = 5; - uint32 storage_gb = 6; + uint32 memory_mib = 5; + uint32 storage_mib = 6; string country = 7; string region = 8; string city = 9; @@ -176,7 +182,7 @@ message VmNodeListResp { 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 + uint64 price = 8; // nanocredits per month per slot } message ExtendVmReq {