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

Method put_message

crates/openshell-server/src/persistence/mod.rs:605–625  ·  view source on GitHub ↗
(
        &self,
        message: &T,
    )

Source from the content-addressed store, hash-verified

603 }
604
605 pub async fn put_message<T: Message + ObjectType + ObjectId + ObjectName + ObjectLabels>(
606 &self,
607 message: &T,
608 ) -> PersistenceResult<()> {
609 let labels_map = message.object_labels();
610 let labels_json = if labels_map.as_ref().is_none_or(HashMap::is_empty) {
611 None
612 } else {
613 Some(serde_json::to_string(&labels_map).map_err(|e| {
614 PersistenceError::Encode(format!("failed to serialize labels: {e}"))
615 })?)
616 };
617 self.put(
618 T::object_type(),
619 message.object_id(),
620 message.object_name(),
621 &message.encode_to_vec(),
622 labels_json.as_deref(),
623 )
624 .await
625 }
626}
627
628#[cfg(test)]

Calls 4

object_labelsMethod · 0.80
object_idMethod · 0.80
object_nameMethod · 0.80
putMethod · 0.45