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

Function encode_count

nodedb/src/data/executor/response_codec/encode.rs:80–86  ·  view source on GitHub ↗

Encode a simple `{"key": count}` response (for insert confirmations).

(key: &str, count: usize)

Source from the content-addressed store, hash-verified

78
79/// Encode a simple `{"key": count}` response (for insert confirmations).
80pub(in crate::data::executor) fn encode_count(key: &str, count: usize) -> crate::Result<Vec<u8>> {
81 let mut map = std::collections::BTreeMap::new();
82 map.insert(key, count);
83 zerompk::to_msgpack_vec(&map).map_err(|e| crate::Error::Codec {
84 detail: format!("count response serialization: {e}"),
85 })
86}
87
88/// Decode a MessagePack or JSON payload to a JSON string for pgwire/HTTP output.
89///

Calls 1

insertMethod · 0.45

Tested by 1

encode_count_msgFunction · 0.68