aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-08 10:45:20 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-08 10:45:20 +0200
commit08cd5f2f1d4a42e63a256eb3a7811e874d222fe4 (patch)
tree256ee885e93cf1c41dc2869fe13a648aa91ab9b5
parent18d014dcc5840e5eae8581a5bfa846aad93beeea (diff)
downloadgarage-background-task-manager.tar.gz
garage-background-task-manager.zip
-rw-r--r--Cargo.lock2
-rw-r--r--src/block/manager.rs5
-rw-r--r--src/block/repair.rs10
-rw-r--r--src/garage/repair/online.rs10
-rw-r--r--src/table/gc.rs5
-rw-r--r--src/table/merkle.rs5
-rw-r--r--src/util/background/job_worker.rs5
7 files changed, 9 insertions, 33 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c45ee015..e1ccfc2d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1737,7 +1737,7 @@ dependencies = [
[[package]]
name = "k2v-client"
-version = "0.1.0"
+version = "0.0.1"
dependencies = [
"base64",
"clap 3.1.18",
diff --git a/src/block/manager.rs b/src/block/manager.rs
index e54fb992..017ba9da 100644
--- a/src/block/manager.rs
+++ b/src/block/manager.rs
@@ -773,10 +773,7 @@ impl Worker for ResyncWorker {
}
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
self.tranquilizer.reset();
match self.manager.resync_iter().await {
Ok(ResyncIterResult::BusyDidSomething) => Ok(self
diff --git a/src/block/repair.rs b/src/block/repair.rs
index cd5afe44..07ff6772 100644
--- a/src/block/repair.rs
+++ b/src/block/repair.rs
@@ -62,10 +62,7 @@ impl Worker for RepairWorker {
}
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
match self.block_iter.as_mut() {
None => {
// Phase 1: Repair blocks from RC table.
@@ -279,10 +276,7 @@ impl Worker for ScrubWorker {
))
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
match self.rx_cmd.try_recv() {
Ok(cmd) => self.handle_cmd(cmd).await,
Err(mpsc::error::TryRecvError::Disconnected) => return Ok(WorkerState::Done),
diff --git a/src/garage/repair/online.rs b/src/garage/repair/online.rs
index 160ce8f8..e33cf097 100644
--- a/src/garage/repair/online.rs
+++ b/src/garage/repair/online.rs
@@ -89,10 +89,7 @@ impl Worker for RepairVersionsWorker {
Some(format!("{} items done", self.counter))
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
let item_bytes = match self.garage.version_table.data.store.get_gt(&self.pos)? {
Some((k, v)) => {
self.pos = k;
@@ -170,10 +167,7 @@ impl Worker for RepairBlockrefsWorker {
Some(format!("{} items done", self.counter))
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
let item_bytes = match self.garage.block_ref_table.data.store.get_gt(&self.pos)? {
Some((k, v)) => {
self.pos = k;
diff --git a/src/table/gc.rs b/src/table/gc.rs
index 9ffae184..12218d97 100644
--- a/src/table/gc.rs
+++ b/src/table/gc.rs
@@ -344,10 +344,7 @@ where
}
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
match self.gc.gc_loop_iter().await? {
None => Ok(WorkerState::Busy),
Some(delay) => {
diff --git a/src/table/merkle.rs b/src/table/merkle.rs
index ca5891a7..a5c29723 100644
--- a/src/table/merkle.rs
+++ b/src/table/merkle.rs
@@ -322,10 +322,7 @@ where
}
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
let updater = self.0.clone();
tokio::task::spawn_blocking(move || {
for _i in 0..100 {
diff --git a/src/util/background/job_worker.rs b/src/util/background/job_worker.rs
index 6754382a..2568ea11 100644
--- a/src/util/background/job_worker.rs
+++ b/src/util/background/job_worker.rs
@@ -21,10 +21,7 @@ impl Worker for JobWorker {
format!("Job worker #{}", self.index)
}
- async fn work(
- &mut self,
- _must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerState, Error> {
+ async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
match self.next_job.take() {
None => return Ok(WorkerState::Idle),
Some(job) => {