updater branch merge #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "updater"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I rewrote the code to be basically carbon copy of newvm because idk what else I can do atp.
@ -79,6 +97,8 @@ service BrainDaemonService {
rpc SendVMConfirmations (stream NewVMConfirmation) returns (Empty);
rpc DeletedVMUpdates (NodePubkey) returns (stream DeletedVMUpdate);
rpc ListVMContracts (ListVMContractsReq) returns (stream VMContract);
rpc GetUpdateVM (NodePubkey) returns (stream UpdateVMRequest);
These streams are becoming confusing and hard to read, both in the proto and also in the code. We should improve readability a bit by renaming some of the RPCs and some of the messages.
Let's do this:
@ -43,0 +54,4 @@
message UpdateVMResp {
string uuid = 1;
string timestamp = 2;
I believe timestamp is not needed in the response here. It's enough if the timestamp gets recorded in the Contract.
This also means that the contract will have two fields:
created_at
andupdated_at
.@ -202,10 +214,42 @@ impl BrainData {
self.contracts.write().unwrap().push(contract);
}
pub async fn submit_update_vmconfirmation(&self, confirmation: grpc::UpdateVmResp) {
This method really needs a new name. 😄
Maybe
process_updatevmresp
. This means we should check all methods indata.rs
to see if they can be renamed to something that makes more sense.idk, the current name is self-describtive, unlike process_updatevmresp... like process could mean to do anything
Let me think about this one...
@ -205,0 +237,4 @@
return;
}
let mut contracts = self.contracts.write().unwrap();
if let Some(contract) = contracts.iter_mut().find(|c| c.uuid == confirmation.uuid) {
I believe this is where we should modify the
updated_at
field.