Dispatch based on bench method

This commit is contained in:
Joscha 2023-08-12 02:26:15 +02:00
parent b23fc6460f
commit 9fc7c22ae8
3 changed files with 45 additions and 1 deletions

View file

@ -1,3 +1,6 @@
mod internal;
mod repo;
use std::{ use std::{
collections::HashMap, collections::HashMap,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
@ -5,6 +8,7 @@ use std::{
use time::OffsetDateTime; use time::OffsetDateTime;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tracing::{debug_span, error, Instrument};
use crate::{ use crate::{
id, id,
@ -89,5 +93,16 @@ pub async fn run(
abort_rx: mpsc::UnboundedReceiver<()>, abort_rx: mpsc::UnboundedReceiver<()>,
bench_method: BenchMethod, bench_method: BenchMethod,
) { ) {
// TODO Implement async {
let result = match bench_method {
BenchMethod::Internal => internal::run(run, abort_rx).await,
BenchMethod::Repo { hash } => repo::run(run, hash, abort_rx).await,
};
match result {
Ok(()) => {}
Err(e) => error!("Error during run:\n{e:?}"),
}
}
.instrument(debug_span!("run"))
.await;
} }

View file

@ -0,0 +1,14 @@
use std::sync::{Arc, Mutex};
use tokio::sync::mpsc;
use crate::somehow;
use super::Run;
pub async fn run(
run: Arc<Mutex<Run>>,
abort_rx: mpsc::UnboundedReceiver<()>,
) -> somehow::Result<()> {
todo!()
}

15
src/worker/run/repo.rs Normal file
View file

@ -0,0 +1,15 @@
use std::sync::{Arc, Mutex};
use tokio::sync::mpsc;
use crate::somehow;
use super::Run;
pub async fn run(
run: Arc<Mutex<Run>>,
hash: String,
abort_rx: mpsc::UnboundedReceiver<()>,
) -> somehow::Result<()> {
todo!()
}