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

Function encode_value_rows

nodedb/src/data/executor/dispatch/array/encode.rs:20–37  ·  view source on GitHub ↗
(core: &CoreLoop, task: &ExecutionTask, rows: &[Value])

Source from the content-addressed store, hash-verified

18use crate::data::executor::task::ExecutionTask;
19
20pub(super) fn encode_value_rows(core: &CoreLoop, task: &ExecutionTask, rows: &[Value]) -> Response {
21 let mut buf: Vec<u8> = Vec::with_capacity(rows.len() * 64);
22 write_array_header(&mut buf, rows.len());
23 for row in rows {
24 match nodedb_types::value_to_msgpack(row) {
25 Ok(b) => buf.extend_from_slice(&b),
26 Err(e) => {
27 return core.response_error(
28 task,
29 ErrorCode::Internal {
30 detail: format!("array response encode: {e}"),
31 },
32 );
33 }
34 }
35 }
36 core.response_with_payload(task, buf)
37}
38
39fn write_array_header(buf: &mut Vec<u8>, len: usize) {
40 if len < 16 {

Callers 2

Calls 5

value_to_msgpackFunction · 0.85
response_errorMethod · 0.80
response_with_payloadMethod · 0.80
write_array_headerFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected