updated for brain update
This commit is contained in:
parent
4f718b39bb
commit
b6dd68fc89
@ -54,7 +54,6 @@ message UpdateVMReq {
|
|||||||
|
|
||||||
message UpdateVMResp {
|
message UpdateVMResp {
|
||||||
string uuid = 1;
|
string uuid = 1;
|
||||||
string timestamp = 2;
|
|
||||||
string error = 3;
|
string error = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +71,7 @@ message VMContract {
|
|||||||
string kernel_sha = 11;
|
string kernel_sha = 11;
|
||||||
string dtrfs_sha = 12;
|
string dtrfs_sha = 12;
|
||||||
string created_at = 13;
|
string created_at = 13;
|
||||||
|
string updated_at = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListVMContractsReq {
|
message ListVMContractsReq {
|
||||||
|
@ -69,6 +69,7 @@ pub struct Contract {
|
|||||||
pub kernel_sha: String,
|
pub kernel_sha: String,
|
||||||
pub dtrfs_sha: String,
|
pub dtrfs_sha: String,
|
||||||
pub created_at: String,
|
pub created_at: String,
|
||||||
|
pub updated_at: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<grpc::VmContract> for Contract {
|
impl Into<grpc::VmContract> for Contract {
|
||||||
@ -87,6 +88,7 @@ impl Into<grpc::VmContract> for Contract {
|
|||||||
kernel_sha: self.kernel_sha,
|
kernel_sha: self.kernel_sha,
|
||||||
dtrfs_sha: self.dtrfs_sha,
|
dtrfs_sha: self.dtrfs_sha,
|
||||||
created_at: self.created_at,
|
created_at: self.created_at,
|
||||||
|
updated_at: self.updated_at,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,6 +203,7 @@ impl BrainData {
|
|||||||
public_ipv4: confirmation.public_ipv4,
|
public_ipv4: confirmation.public_ipv4,
|
||||||
public_ipv6: confirmation.public_ipv6,
|
public_ipv6: confirmation.public_ipv6,
|
||||||
created_at: format!("{:?}", std::time::SystemTime::now()),
|
created_at: format!("{:?}", std::time::SystemTime::now()),
|
||||||
|
updated_at: format!("{:?}", std::time::SystemTime::now()),
|
||||||
hostname: newvmreq.0.hostname,
|
hostname: newvmreq.0.hostname,
|
||||||
admin_pubkey: newvmreq.0.admin_pubkey,
|
admin_pubkey: newvmreq.0.admin_pubkey,
|
||||||
node_pubkey: newvmreq.0.node_pubkey,
|
node_pubkey: newvmreq.0.node_pubkey,
|
||||||
@ -243,6 +246,7 @@ impl BrainData {
|
|||||||
contract.memory_mb = updatevmreq.0.memory_mb;
|
contract.memory_mb = updatevmreq.0.memory_mb;
|
||||||
contract.kernel_sha = updatevmreq.0.kernel_sha;
|
contract.kernel_sha = updatevmreq.0.kernel_sha;
|
||||||
contract.dtrfs_sha = updatevmreq.0.dtrfs_sha;
|
contract.dtrfs_sha = updatevmreq.0.dtrfs_sha;
|
||||||
|
contract.updated_at = format!("{:?}", std::time::SystemTime::now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +311,6 @@ impl BrainData {
|
|||||||
);
|
);
|
||||||
self.submit_update_vmconfirmation(grpc::UpdateVmResp {
|
self.submit_update_vmconfirmation(grpc::UpdateVmResp {
|
||||||
uuid,
|
uuid,
|
||||||
timestamp: format!("{:?}", std::time::SystemTime::now()),
|
|
||||||
error: "Daemon is offline.".to_string(),
|
error: "Daemon is offline.".to_string(),
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
@ -317,7 +320,6 @@ impl BrainData {
|
|||||||
warn!("No daemon TX found for {}", req.node_pubkey);
|
warn!("No daemon TX found for {}", req.node_pubkey);
|
||||||
self.submit_update_vmconfirmation(grpc::UpdateVmResp {
|
self.submit_update_vmconfirmation(grpc::UpdateVmResp {
|
||||||
uuid,
|
uuid,
|
||||||
timestamp: format!("{:?}", std::time::SystemTime::now()),
|
|
||||||
error: "Daemon is offline.".to_string(),
|
error: "Daemon is offline.".to_string(),
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
@ -181,7 +181,6 @@ impl BrainDaemonService for BrainDaemonMock {
|
|||||||
data.submit_update_vmconfirmation(UpdateVmResp {
|
data.submit_update_vmconfirmation(UpdateVmResp {
|
||||||
error: "Daemon not connected.".to_string(),
|
error: "Daemon not connected.".to_string(),
|
||||||
uuid: updatevmreq.uuid,
|
uuid: updatevmreq.uuid,
|
||||||
timestamp: format!("{:?}", std::time::SystemTime::now()),
|
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
break;
|
break;
|
||||||
@ -202,9 +201,8 @@ impl BrainDaemonService for BrainDaemonMock {
|
|||||||
let mut confirmations = req.into_inner();
|
let mut confirmations = req.into_inner();
|
||||||
while let Some(confirmation) = confirmations.next().await {
|
while let Some(confirmation) = confirmations.next().await {
|
||||||
match confirmation {
|
match confirmation {
|
||||||
Ok(mut c) => {
|
Ok(c) => {
|
||||||
info!("Received confirmation from daemon: {c:?}");
|
info!("Received confirmation from daemon: {c:?}");
|
||||||
c.timestamp = format!("{:?}", std::time::SystemTime::now());
|
|
||||||
self.data.submit_update_vmconfirmation(c).await;
|
self.data.submit_update_vmconfirmation(c).await;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user