aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-28 16:59:19 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-28 16:59:19 +0200
commitb053fc051842677dbabe1cab294af74ed26932a4 (patch)
tree68600a49ad5a10e21e21a0a2429aa0305c12f11c /src/util
parentf1c972289d53e956a5837dcae2a53cc13f61ec7b (diff)
downloadgarage-b053fc051842677dbabe1cab294af74ed26932a4.tar.gz
garage-b053fc051842677dbabe1cab294af74ed26932a4.zip
Persist scrub worker thing in Persister
Diffstat (limited to 'src/util')
-rw-r--r--src/util/background/worker.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util/background/worker.rs b/src/util/background/worker.rs
index c08a0aaa..7fd63c2b 100644
--- a/src/util/background/worker.rs
+++ b/src/util/background/worker.rs
@@ -15,7 +15,7 @@ use crate::background::WorkerInfo;
use crate::error::Error;
use crate::time::now_msec;
-#[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)]
+#[derive(PartialEq, Copy, Clone, Serialize, Deserialize, Debug)]
pub enum WorkerStatus {
Busy,
Throttled(f32),
@@ -23,6 +23,17 @@ pub enum WorkerStatus {
Done,
}
+impl std::fmt::Display for WorkerStatus {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ WorkerStatus::Busy => write!(f, "Busy"),
+ WorkerStatus::Throttled(t) => write!(f, "Thr:{:.3}", t),
+ WorkerStatus::Idle => write!(f, "Idle"),
+ WorkerStatus::Done => write!(f, "Done"),
+ }
+ }
+}
+
#[async_trait]
pub trait Worker: Send {
fn name(&self) -> String;