From b053fc051842677dbabe1cab294af74ed26932a4 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 28 Jun 2022 16:59:19 +0200 Subject: Persist scrub worker thing in Persister --- src/util/background/worker.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/util') 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; -- cgit v1.2.3