MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / get_children_views

Method get_children_views

atomic-core/src/pristine/traits/view.rs:405–418  ·  view source on GitHub ↗

Find all views that have the given view as their parent. Used during view deletion to check for child views that would be orphaned. A view with children cannot be deleted without first reparenting or deleting its children.

(&self, parent_id: u64)

Source from the content-addressed store, hash-verified

403 /// orphaned. A view with children cannot be deleted without first
404 /// reparenting or deleting its children.
405 fn get_children_views(&self, parent_id: u64) -> Result<Vec<ViewState>, PristineError> {
406 // Default implementation: scan all views and filter by parent.
407 // View counts are typically small (<100), so this is fine.
408 let names = self.list_views()?;
409 let mut children = Vec::new();
410 for name in names {
411 if let Some(view) = self.get_view(&name)? {
412 if view.parent == Some(parent_id) {
413 children.push(view);
414 }
415 }
416 }
417 Ok(children)
418 }
419
420 /// Read the persisted conflicts for a file (`inode`) on a view.
421 ///

Callers

nothing calls this directly

Implementers 3

context.rsatomic-core/src/record/context.rs
read.rsatomic-core/src/pristine/txn/read.rs
view.rsatomic-core/src/pristine/txn/write/vie

Calls 3

list_viewsMethod · 0.45
get_viewMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected