updater branch merge #1

Merged
ghe0 merged 10 commits from updater into main 2024-12-25 22:59:18 +00:00
Collaborator

I rewrote the code to be basically carbon copy of newvm because idk what else I can do atp.

I rewrote the code to be basically carbon copy of newvm because idk what else I can do atp.
ramrem added 6 commits 2024-12-25 20:14:50 +00:00
ghe0 requested changes 2024-12-25 20:49:46 +00:00
brain.proto Outdated
@ -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);
Owner

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:

service BrainDaemonService {
  rpc RegisterNode (RegisterNodeReq) returns (Empty);
  rpc GetNewVMReqs (NodePubkey) returns (stream NewVMReq);
  rpc SendNewVMResp (stream NewVMResp) returns (Empty);
  rpc GetDeleteVMReq (NodePubkey) returns (stream DeleteVMReq);
  rpc ListVMContracts (ListVMContractsReq) returns (stream VMContract);
  rpc GetUpdateVMReq (NodePubkey) returns (stream UpdateVMReq);
  rpc SendUpdateVMResp (stream UpdateVMResp) returns (Empty);
}
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: ``` service BrainDaemonService { rpc RegisterNode (RegisterNodeReq) returns (Empty); rpc GetNewVMReqs (NodePubkey) returns (stream NewVMReq); rpc SendNewVMResp (stream NewVMResp) returns (Empty); rpc GetDeleteVMReq (NodePubkey) returns (stream DeleteVMReq); rpc ListVMContracts (ListVMContractsReq) returns (stream VMContract); rpc GetUpdateVMReq (NodePubkey) returns (stream UpdateVMReq); rpc SendUpdateVMResp (stream UpdateVMResp) returns (Empty); } ```
ghe0 marked this conversation as resolved
ramrem added 1 commit 2024-12-25 21:08:01 +00:00
ramrem added 1 commit 2024-12-25 21:24:05 +00:00
ghe0 requested changes 2024-12-25 21:27:42 +00:00
@ -43,0 +54,4 @@
message UpdateVMResp {
string uuid = 1;
string timestamp = 2;
Owner

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 and updated_at.

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` and `updated_at`.
ghe0 marked this conversation as resolved
src/data.rs Outdated
@ -202,10 +214,42 @@ impl BrainData {
self.contracts.write().unwrap().push(contract);
}
pub async fn submit_update_vmconfirmation(&self, confirmation: grpc::UpdateVmResp) {
Owner

This method really needs a new name. 😄

Maybe process_updatevmresp. This means we should check all methods in data.rs to see if they can be renamed to something that makes more sense.

This method really needs a new name. 😄 Maybe `process_updatevmresp`. This means we should check all methods in `data.rs` to see if they can be renamed to something that makes more sense.
Author
Collaborator

idk, the current name is self-describtive, unlike process_updatevmresp... like process could mean to do anything

idk, the current name is self-describtive, unlike process_updatevmresp... like process could mean to do anything
Owner

Let me think about this one...

Let me think about this one...
ghe0 marked this conversation as resolved
@ -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) {
Owner

I believe this is where we should modify the updated_at field.

I believe this is where we should modify the `updated_at` field.
ghe0 marked this conversation as resolved
ramrem added 1 commit 2024-12-25 21:54:42 +00:00
ghe0 added 1 commit 2024-12-25 22:56:42 +00:00
ghe0 merged commit 0215be3acd into main 2024-12-25 22:59:18 +00:00
ghe0 deleted branch updater 2024-12-25 22:59:19 +00:00
ghe0 referenced this issue from a commit 2024-12-25 22:59:19 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ghe0/brain-mock#1
No description provided.