Propose every entry in the plan sequentially, waiting for each commit. Returns the total number of entries committed and the final applied index.
(self)
| 69 | /// each commit. Returns the total number of entries committed |
| 70 | /// and the final applied index. |
| 71 | pub async fn run(self) -> Result<DecommissionRunResult> { |
| 72 | let node_id = self.plan.node_id; |
| 73 | let total = self.plan.entries.len(); |
| 74 | info!(node_id, steps = total, "decommission coordinator starting"); |
| 75 | let mut last_applied = 0u64; |
| 76 | for (step, entry) in self.plan.entries.into_iter().enumerate() { |
| 77 | debug!(node_id, step, total, "proposing decommission entry"); |
| 78 | last_applied = self.proposer.propose_and_wait(entry).await?; |
| 79 | } |
| 80 | info!( |
| 81 | node_id, |
| 82 | entries_committed = total, |
| 83 | last_applied, |
| 84 | "decommission coordinator finished" |
| 85 | ); |
| 86 | Ok(DecommissionRunResult { |
| 87 | node_id, |
| 88 | entries_committed: total, |
| 89 | last_applied_index: last_applied, |
| 90 | }) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | #[cfg(test)] |
no test coverage detected