MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / remove

Method remove

crates/core/src/api/runtime/scope_stack.rs:125–150  ·  view source on GitHub ↗

Remove the current top scope if it matches `uuid`. # Parameters - `uuid`: UUID of the scope expected to be at the top of the stack. # Returns A [`Result`] containing the removed [`ScopeHandle`]. # Errors Returns [`FlowError::InvalidArgument`] when the scope exists but is not the current top of the stack or when the caller attempts to remove the implicit root scope. Returns [`FlowError::NotFound

(&mut self, uuid: &Uuid)

Source from the content-addressed store, hash-verified

123 /// implicit root scope. Returns [`FlowError::NotFound`] when the UUID is
124 /// not present on the stack.
125 pub fn remove(&mut self, uuid: &Uuid) -> Result<ScopeHandle> {
126 let top = self
127 .stack
128 .last()
129 .expect("scope stack should never be empty");
130 if top.uuid == *uuid {
131 if self.stack.len() == 1 {
132 return Err(FlowError::InvalidArgument(
133 "root scope cannot be removed".into(),
134 ));
135 }
136 self.scope_registries.remove(uuid);
137 return Ok(self
138 .stack
139 .pop()
140 .expect("scope stack should contain a removable top scope"));
141 }
142
143 if self.stack.iter().any(|handle| handle.uuid == *uuid) {
144 return Err(FlowError::InvalidArgument(
145 "scope handle is not at the top of the stack".into(),
146 ));
147 }
148
149 Err(FlowError::NotFound("scope handle not found".into()))
150 }
151
152 /// Get or create the scope-local registries for an active scope.
153 ///

Callers 15

dropMethod · 0.45
resolve_warm_first_roleFunction · 0.45
cleanup_cohort_gateFunction · 0.45
finish_runMethod · 0.45
track_call_endMethod · 0.45
deregisterMethod · 0.45
bind_scopeMethod · 0.45
deregister_pluginFunction · 0.45
deregisterMethod · 0.45
process_endMethod · 0.45
sanitized_llm_input_jsonFunction · 0.45

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected