aboutsummaryrefslogtreecommitdiff
path: root/src/garage
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-08 10:39:41 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-08 10:39:41 +0200
commitd1cf1a0fa6952e84874f36f1dc66e4a978959d8f (patch)
treef65135f725b9f22ac2eac54e5023ab6a548549ec /src/garage
parent0f660b086c23d13c91b0c55fd4d43017a09c1f4b (diff)
downloadgarage-d1cf1a0fa6952e84874f36f1dc66e4a978959d8f.tar.gz
garage-d1cf1a0fa6952e84874f36f1dc66e4a978959d8f.zip
Rename WorkerStatus to WorkerState
because it's a state in a state machine
Diffstat (limited to 'src/garage')
-rw-r--r--src/garage/cli/util.rs12
-rw-r--r--src/garage/repair/online.rs16
2 files changed, 14 insertions, 14 deletions
diff --git a/src/garage/cli/util.rs b/src/garage/cli/util.rs
index 8be56138..396938ae 100644
--- a/src/garage/cli/util.rs
+++ b/src/garage/cli/util.rs
@@ -245,10 +245,10 @@ pub fn print_worker_info(wi: HashMap<usize, WorkerInfo>, wlo: WorkerListOpt) {
let mut wi = wi.into_iter().collect::<Vec<_>>();
wi.sort_by_key(|(tid, info)| {
(
- match info.status {
- WorkerStatus::Busy | WorkerStatus::Throttled(_) => 0,
- WorkerStatus::Idle => 1,
- WorkerStatus::Done => 2,
+ match info.state {
+ WorkerState::Busy | WorkerState::Throttled(_) => 0,
+ WorkerState::Idle => 1,
+ WorkerState::Done => 2,
},
*tid,
)
@@ -256,14 +256,14 @@ pub fn print_worker_info(wi: HashMap<usize, WorkerInfo>, wlo: WorkerListOpt) {
let mut table = vec![];
for (tid, info) in wi.iter() {
- if wlo.busy && !matches!(info.status, WorkerStatus::Busy | WorkerStatus::Throttled(_)) {
+ if wlo.busy && !matches!(info.state, WorkerState::Busy | WorkerState::Throttled(_)) {
continue;
}
if wlo.errors && info.errors == 0 {
continue;
}
- table.push(format!("{}\t{}\t{}", tid, info.status, info.name));
+ table.push(format!("{}\t{}\t{}", tid, info.state, info.name));
if let Some(i) = &info.info {
table.push(format!("\t\t {}", i));
}
diff --git a/src/garage/repair/online.rs b/src/garage/repair/online.rs
index eeb9cea3..160ce8f8 100644
--- a/src/garage/repair/online.rs
+++ b/src/garage/repair/online.rs
@@ -92,7 +92,7 @@ impl Worker for RepairVersionsWorker {
async fn work(
&mut self,
_must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerStatus, Error> {
+ ) -> Result<WorkerState, Error> {
let item_bytes = match self.garage.version_table.data.store.get_gt(&self.pos)? {
Some((k, v)) => {
self.pos = k;
@@ -100,7 +100,7 @@ impl Worker for RepairVersionsWorker {
}
None => {
info!("repair_versions: finished, done {}", self.counter);
- return Ok(WorkerStatus::Done);
+ return Ok(WorkerState::Done);
}
};
@@ -134,10 +134,10 @@ impl Worker for RepairVersionsWorker {
}
}
- Ok(WorkerStatus::Busy)
+ Ok(WorkerState::Busy)
}
- async fn wait_for_work(&mut self, _must_exit: &watch::Receiver<bool>) -> WorkerStatus {
+ async fn wait_for_work(&mut self, _must_exit: &watch::Receiver<bool>) -> WorkerState {
unreachable!()
}
}
@@ -173,7 +173,7 @@ impl Worker for RepairBlockrefsWorker {
async fn work(
&mut self,
_must_exit: &mut watch::Receiver<bool>,
- ) -> Result<WorkerStatus, Error> {
+ ) -> Result<WorkerState, Error> {
let item_bytes = match self.garage.block_ref_table.data.store.get_gt(&self.pos)? {
Some((k, v)) => {
self.pos = k;
@@ -181,7 +181,7 @@ impl Worker for RepairBlockrefsWorker {
}
None => {
info!("repair_block_ref: finished, done {}", self.counter);
- return Ok(WorkerStatus::Done);
+ return Ok(WorkerState::Done);
}
};
@@ -212,10 +212,10 @@ impl Worker for RepairBlockrefsWorker {
}
}
- Ok(WorkerStatus::Busy)
+ Ok(WorkerState::Busy)
}
- async fn wait_for_work(&mut self, _must_exit: &watch::Receiver<bool>) -> WorkerStatus {
+ async fn wait_for_work(&mut self, _must_exit: &watch::Receiver<bool>) -> WorkerState {
unreachable!()
}
}