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

Method get_children_views

atomic-core/src/pristine/traits/view.rs:353–366  ·  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

351 /// orphaned. A view with children cannot be deleted without first
352 /// reparenting or deleting its children.
353 fn get_children_views(&self, parent_id: u64) -> Result<Vec<ViewState>, PristineError> {
354 // Default implementation: scan all views and filter by parent.
355 // View counts are typically small (<100), so this is fine.
356 let names = self.list_views()?;
357 let mut children = Vec::new();
358 for name in names {
359 if let Some(view) = self.get_view(&name)? {
360 if view.parent == Some(parent_id) {
361 children.push(view);
362 }
363 }
364 }
365 Ok(children)
366 }
367
368 /// Get a view by name.
369 fn get_view(&self, name: &str) -> Result<Option<ViewState>, PristineError>;

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