MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / encode_to_msgpack

Function encode_to_msgpack

nodedb/src/data/executor/doc_format.rs:73–78  ·  view source on GitHub ↗

Encode a JSON value as MessagePack bytes for storage. If encoding fails (should not happen for valid `serde_json::Value`), falls back to JSON bytes.

(value: &serde_json::Value)

Source from the content-addressed store, hash-verified

71/// If encoding fails (should not happen for valid `serde_json::Value`),
72/// falls back to JSON bytes.
73pub(super) fn encode_to_msgpack(value: &serde_json::Value) -> Vec<u8> {
74 nodedb_types::json_to_msgpack(value).unwrap_or_else(|_| {
75 // Fallback: store as JSON if MessagePack encoding fails.
76 sonic_rs::to_vec(value).unwrap_or_default()
77 })
78}
79
80/// Convert JSON bytes to MessagePack bytes.
81///

Callers 12

json_to_msgpackFunction · 0.85
execute_bulk_updateMethod · 0.85
find_armFunction · 0.85
apply_actionFunction · 0.85
apply_insert_actionFunction · 0.85
apply_point_putMethod · 0.85
execute_point_updateMethod · 0.85
apply_chain_on_insertFunction · 0.85
apply_single_bindingFunction · 0.85

Calls 1

json_to_msgpackFunction · 0.70

Tested by

no test coverage detected