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

Function named_view

libatomic/src/daemon/services_sandbox.rs:109–121  ·  view source on GitHub ↗

The view a request names: `target`'s name, or `legacy` (the admin requests' display-hint string). A `target.view_id` must agree with it.

(target: Option<&ViewRef>, legacy: &str)

Source from the content-addressed store, hash-verified

107/// The view a request names: `target`'s name, or `legacy` (the admin
108/// requests' display-hint string). A `target.view_id` must agree with it.
109fn named_view(target: Option<&ViewRef>, legacy: &str) -> Result<String, Status> {
110 let name = target
111 .and_then(|t| t.name.clone())
112 .filter(|n| !n.is_empty())
113 .or_else(|| (!legacy.is_empty()).then(|| legacy.to_string()))
114 .ok_or_else(|| invalid("name the target view"))?;
115 if let Some(target) = target {
116 if !target.view_id.is_empty() && target.view_id != view_ref_id(&name) {
117 return Err(invalid("target view_id and name disagree"));
118 }
119 }
120 Ok(name)
121}
122
123/// The view a data op acts on: a sandbox's grant view (an explicit target
124/// must be it, and the grant must carry `capability`), or the view a local

Callers 4

data_viewFunction · 0.85
open_sandboxMethod · 0.85
renew_sandboxMethod · 0.85
close_sandboxMethod · 0.85

Calls 4

view_ref_idFunction · 0.85
invalidFunction · 0.70
cloneMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected