MCPcopy Index your code
hub / github.com/cargo-lambda/cargo-lambda / upsert

Method upsert

crates/cargo-lambda-watch/src/state.rs:160–181  ·  view source on GitHub ↗
(&self, req: InvokeRequest)

Source from the content-addressed store, hash-verified

158 }
159
160 pub async fn upsert(&self, req: InvokeRequest) -> Result<Option<String>, ServerError> {
161 let mut inner = self.inner.write().await;
162 let function_name = req.function_name.clone();
163
164 match inner.entry(function_name.clone()) {
165 Entry::Vacant(v) => {
166 let stack = RequestQueue::new();
167 stack.push(req).await?;
168 v.insert(stack);
169
170 debug!(?function_name, "request stack initialized in first request");
171
172 Ok(Some(function_name))
173 }
174 Entry::Occupied(o) => {
175 o.into_mut().push(req).await?;
176 debug!(?function_name, "request stack increased");
177
178 Ok(None)
179 }
180 }
181 }
182
183 pub async fn pop(&self, function_name: &str) -> Option<InvokeRequest> {
184 let inner = self.inner.read().await;

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
pushMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected