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

Function remove_segment

nodedb/src/engine/array/purge/execute.rs:246–259  ·  view source on GitHub ↗

Remove a segment from the manifest and unlink its file.

(store: &mut ArrayStore, seg_ref: &SegmentRef)

Source from the content-addressed store, hash-verified

244
245/// Remove a segment from the manifest and unlink its file.
246fn remove_segment(store: &mut ArrayStore, seg_ref: &SegmentRef) -> Result<(), ArrayError> {
247 store
248 .replace_segments(std::slice::from_ref(&seg_ref.id), vec![])
249 .map_err(|e| ArrayError::SegmentCorruption {
250 detail: format!("purge: remove_segments {}: {e}", seg_ref.id),
251 })?;
252 store
253 .persist_manifest()
254 .map_err(|e| ArrayError::SegmentCorruption {
255 detail: format!("purge: persist_manifest (remove): {e}"),
256 })?;
257 let _ = store.unlink_segment(&seg_ref.id);
258 Ok(())
259}
260
261fn update_bounds(min: &mut Option<TileId>, max: &mut Option<TileId>, id: TileId) {
262 *min = Some(min.map_or(id, |m| m.min(id)));

Callers 1

rewrite_segmentFunction · 0.70

Calls 3

replace_segmentsMethod · 0.80
persist_manifestMethod · 0.80
unlink_segmentMethod · 0.80

Tested by

no test coverage detected