Update proto messages and Rust types for brain integration
removed uuid type and change it a simple string improved some grpc response type fix some typos
This commit is contained in:
parent
3e783b11ba
commit
a2899ba5a2
@ -6,10 +6,11 @@ import "shared.proto";
|
|||||||
|
|
||||||
|
|
||||||
message NewContainerRes {
|
message NewContainerRes {
|
||||||
optional shared.UUID container_id = 1;
|
string uuid = 1;
|
||||||
string status = 2;
|
string status = 2;
|
||||||
string ip_address = 3;
|
string ip_address = 3;
|
||||||
repeated shared.MappedPort mapped_ports = 4;
|
repeated shared.MappedPort mapped_ports = 4;
|
||||||
|
string error = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ContainerInspectResp {
|
message ContainerInspectResp {
|
||||||
@ -30,7 +31,7 @@ message LogResp {
|
|||||||
|
|
||||||
message ContainerFilters {
|
message ContainerFilters {
|
||||||
string admin_pubkey = 1;
|
string admin_pubkey = 1;
|
||||||
optional shared.UUID container_id = 2;
|
optional string container_id = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ContainerListResp {
|
message ContainerListResp {
|
||||||
@ -38,7 +39,7 @@ message ContainerListResp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message DeleteContainerRes {
|
message DeleteContainerRes {
|
||||||
optional shared.UUID container_id = 1;
|
optional string container_id = 1;
|
||||||
string status = 2;
|
string status = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +56,8 @@ message BrainMessage {
|
|||||||
message DaemonMessage {
|
message DaemonMessage {
|
||||||
oneof Msg {
|
oneof Msg {
|
||||||
shared.Pubkey pubkey = 1;
|
shared.Pubkey pubkey = 1;
|
||||||
NewContainerRes new_vm_resp = 2;
|
NewContainerRes new_container_resp = 2;
|
||||||
DeleteContainerRes delete_vm_resp = 3;
|
DeleteContainerRes delete_container_resp = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,11 +8,7 @@ message SetConfigResponse {
|
|||||||
|
|
||||||
message Empty {
|
message Empty {
|
||||||
}
|
}
|
||||||
message UUID {
|
|
||||||
string uuid = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The main Config structure
|
|
||||||
message ManagerConfigPB {
|
message ManagerConfigPB {
|
||||||
repeated FileEntry filesystems = 1;
|
repeated FileEntry filesystems = 1;
|
||||||
repeated EnvironmentEntry environments = 2;
|
repeated EnvironmentEntry environments = 2;
|
||||||
@ -20,13 +16,11 @@ message ManagerConfigPB {
|
|||||||
Container container = 4;
|
Container container = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents a file entry with a path and content
|
|
||||||
message FileEntry {
|
message FileEntry {
|
||||||
string path = 1;
|
string path = 1;
|
||||||
string content = 2;
|
string content = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents an environment variable entry
|
|
||||||
message EnvironmentEntry {
|
message EnvironmentEntry {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
string value = 2;
|
string value = 2;
|
||||||
@ -41,7 +35,6 @@ message RestartPolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents a child process configuration
|
|
||||||
message ChildProcess {
|
message ChildProcess {
|
||||||
string path = 1;
|
string path = 1;
|
||||||
repeated string arguments = 2;
|
repeated string arguments = 2;
|
||||||
@ -69,13 +62,14 @@ message ContainerContracts {
|
|||||||
|
|
||||||
|
|
||||||
message Container {
|
message Container {
|
||||||
optional string package_url = 1;
|
string package_url = 1;
|
||||||
string node = 2;
|
string node_pubkey = 2;
|
||||||
Resource resource = 3;
|
Resource resource = 3;
|
||||||
UUID uuid = 4;
|
string uuid = 4;
|
||||||
string admin_pubkey = 5;
|
string admin_pubkey = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message Resource {
|
message Resource {
|
||||||
uint32 memory_mb = 1;
|
uint32 memory_mb = 1;
|
||||||
uint32 disk_mb = 2;
|
uint32 disk_mb = 2;
|
||||||
|
@ -193,22 +193,23 @@ impl From<RestartPolicy> for pb_shared::RestartPolicy {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
pub struct Container {
|
pub struct Container {
|
||||||
pub package_url: Option<String>,
|
pub package_url: String,
|
||||||
pub node: String,
|
|
||||||
pub resource: Option<Resource>,
|
pub resource: Option<Resource>,
|
||||||
pub uuid: Option<Uuid>,
|
#[serde(default)]
|
||||||
|
pub uuid: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub admin_pubkey: String,
|
pub admin_pubkey: String,
|
||||||
|
pub node_pubkey: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<pb_shared::Container> for Container {
|
impl From<pb_shared::Container> for Container {
|
||||||
fn from(pb_val: pb_shared::Container) -> Self {
|
fn from(pb_val: pb_shared::Container) -> Self {
|
||||||
Self {
|
Self {
|
||||||
package_url: pb_val.package_url,
|
package_url: pb_val.package_url,
|
||||||
node: pb_val.node,
|
|
||||||
resource: pb_val.resource.map(Resource::from),
|
resource: pb_val.resource.map(Resource::from),
|
||||||
uuid: pb_val.uuid.map(Uuid::from),
|
uuid: pb_val.uuid,
|
||||||
admin_pubkey: pb_val.admin_pubkey,
|
admin_pubkey: pb_val.admin_pubkey,
|
||||||
|
node_pubkey: pb_val.node_pubkey,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,29 +218,15 @@ impl From<Container> for pb_shared::Container {
|
|||||||
fn from(val: Container) -> pb_shared::Container {
|
fn from(val: Container) -> pb_shared::Container {
|
||||||
pb_shared::Container {
|
pb_shared::Container {
|
||||||
package_url: val.package_url,
|
package_url: val.package_url,
|
||||||
node: val.node,
|
|
||||||
resource: val.resource.map(Into::into),
|
resource: val.resource.map(Into::into),
|
||||||
uuid: val.uuid.map(Into::into),
|
// uuid: val.uuid.map(Into::into),
|
||||||
|
uuid: val.uuid,
|
||||||
admin_pubkey: val.admin_pubkey,
|
admin_pubkey: val.admin_pubkey,
|
||||||
|
node_pubkey: val.node_pubkey,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
|
||||||
pub struct Uuid {
|
|
||||||
pub uuid: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<pb_shared::Uuid> for Uuid {
|
|
||||||
fn from(pb_val: pb_shared::Uuid) -> Self {
|
|
||||||
Self { uuid: pb_val.uuid }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<Uuid> for pb_shared::Uuid {
|
|
||||||
fn from(val: Uuid) -> pb_shared::Uuid {
|
|
||||||
pb_shared::Uuid { uuid: val.uuid }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
||||||
pub struct Resource {
|
pub struct Resource {
|
||||||
pub memory_mb: u32,
|
pub memory_mb: u32,
|
||||||
|
Loading…
Reference in New Issue
Block a user