MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / remove

Method remove

nodedb-cluster/src/metadata_group/migration_state.rs:282–304  ·  view source on GitHub ↗

Remove a checkpoint row (in-memory + redb). No-op if not present.

(&mut self, migration_id: &MigrationId)

Source from the content-addressed store, hash-verified

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> {

Callers 5

applyMethod · 0.45
apply_migration_abortFunction · 0.45
remove_deletes_from_redbFunction · 0.45
phase3_cutoverFunction · 0.45

Calls 4

to_stringMethod · 0.80
begin_writeMethod · 0.80
as_strMethod · 0.45
commitMethod · 0.45

Tested by 1

remove_deletes_from_redbFunction · 0.36