Skip to content

Commit

Permalink
feat(server): Add FinalOdb websocket request
Browse files Browse the repository at this point in the history
  • Loading branch information
DJDuque committed Sep 25, 2024
1 parent c5d54fe commit bb21dba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ changes will be documented in this file.
there are both `*.mid` and `*.mid.lz4` files in the data directory. The
default pattern will match any `runXXXXXsubYYY.mid*` file. To, for example,
match only `*.mid` files, add a `$` anchor to the end of the default pattern.
- New websocket message to request the final ODB.

## [0.1.1] - 2024-08-24

Expand Down
24 changes: 24 additions & 0 deletions src/communication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ pub enum ClientRequest {
InitialOdb {
run_number: u32,
},
FinalOdb {
run_number: u32,
},
SpillLog {
run_number: u32,
},
Expand Down Expand Up @@ -92,6 +95,9 @@ pub async fn handle_client_message(
ClientRequest::InitialOdb { .. } => {
handle_initial_odb(msg, tx, app_state).await;
}
ClientRequest::FinalOdb { .. } => {
handle_final_odb(msg, tx, app_state).await;
}
ClientRequest::SpillLog { .. } => {
handle_spill_log(msg, tx, app_state).await;
}
Expand Down Expand Up @@ -307,6 +313,24 @@ async fn handle_initial_odb(
send_download_jwt(&msg.service, &msg.context, &tx, output);
}

async fn handle_final_odb(
msg: ClientMessage,
tx: mpsc::UnboundedSender<ServerMessage>,
app_state: Arc<AppState>,
) {
let ClientRequest::FinalOdb { run_number } = msg.request else {
unreachable!();
};
let cmd = CoreCmd {
bin: CoreBin::FinalOdb,
run_number,
};
let Ok(output) = run_core_command(&msg.service, &msg.context, cmd, &tx, app_state).await else {
return;
};
send_download_jwt(&msg.service, &msg.context, &tx, output);
}

async fn handle_spill_log(
msg: ClientMessage,
tx: mpsc::UnboundedSender<ServerMessage>,
Expand Down

0 comments on commit bb21dba

Please sign in to comment.