Shared implementation: swap the state, log at INFO, push the status string to systemd.
(&self, new: ClusterLifecycleState, human: &str)
| 163 | /// Shared implementation: swap the state, log at INFO, push the |
| 164 | /// status string to systemd. |
| 165 | fn transition(&self, new: ClusterLifecycleState, human: &str) { |
| 166 | let prev = { |
| 167 | let mut guard = self.inner.write().unwrap_or_else(|p| p.into_inner()); |
| 168 | std::mem::replace(&mut *guard, new.clone()) |
| 169 | }; |
| 170 | info!( |
| 171 | prev = prev.label(), |
| 172 | new = new.label(), |
| 173 | detail = human, |
| 174 | "cluster lifecycle transition" |
| 175 | ); |
| 176 | readiness::notify_status(human); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | impl Default for ClusterLifecycleTracker { |
no test coverage detected