MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / put_if

Method put_if

crates/openshell-server/src/persistence/mod.rs:232–242  ·  view source on GitHub ↗

Insert or update a generic object with compare-and-swap support. # Arguments `object_type` - Type discriminator for the object `id` - Stable object identifier `name` - Human-readable object name `payload` - Serialized object data `labels` - Optional JSON-serialized labels `condition` - Write precondition (`MustCreate`, `MatchResourceVersion`, or `Unconditional`) # Returns `Ok(WriteResult)` - Wri

(
        &self,
        object_type: &str,
        id: &str,
        name: &str,
        payload: &[u8],
        labels: Option<&str>,
        condition: WriteCondition,
    )

Source from the content-addressed store, hash-verified

230 /// * `Err(Conflict)` - Resource version mismatch (for `MatchResourceVersion`)
231 /// * `Err(UniqueViolation)` - Object already exists (for `MustCreate`) or name conflict
232 pub async fn put_if(
233 &self,
234 object_type: &str,
235 id: &str,
236 name: &str,
237 payload: &[u8],
238 labels: Option<&str>,
239 condition: WriteCondition,
240 ) -> PersistenceResult<WriteResult> {
241 store_dispatch!(self.put_if(object_type, id, name, payload, labels, condition))
242 }
243
244 /// Delete an object by id with compare-and-swap support.
245 ///

Calls

no outgoing calls