Remove a checkpoint row (in-memory + redb). No-op if not present.
(&mut self, migration_id: &MigrationId)
| 280 | |
| 281 | /// Remove a checkpoint row (in-memory + redb). No-op if not present. |
| 282 | pub fn remove(&mut self, migration_id: &MigrationId) -> Result<()> { |
| 283 | let key = migration_id.hyphenated().to_string(); |
| 284 | self.mem.remove(&key); |
| 285 | let txn = self.db.begin_write().map_err(|e| ClusterError::Storage { |
| 286 | detail: format!("migration_state begin_write: {e}"), |
| 287 | })?; |
| 288 | { |
| 289 | let mut table = txn |
| 290 | .open_table(Self::TABLE) |
| 291 | .map_err(|e| ClusterError::Storage { |
| 292 | detail: format!("migration_state open_table: {e}"), |
| 293 | })?; |
| 294 | let _ = table |
| 295 | .remove(key.as_str()) |
| 296 | .map_err(|e| ClusterError::Storage { |
| 297 | detail: format!("migration_state remove: {e}"), |
| 298 | })?; |
| 299 | } |
| 300 | txn.commit().map_err(|e| ClusterError::Storage { |
| 301 | detail: format!("migration_state commit: {e}"), |
| 302 | })?; |
| 303 | Ok(()) |
| 304 | } |
| 305 | |
| 306 | /// Get a snapshot of all in-flight checkpoints (in-memory view). |
| 307 | pub fn all_checkpoints(&self) -> Vec<PersistedMigrationCheckpoint> { |