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

Function handle_slice

nodedb-cluster/src/distributed_array/handler.rs:61–83  ·  view source on GitHub ↗
(
    local_vshard_id: u32,
    payload: &[u8],
    executor: &Arc<dyn ArrayLocalExecutor>,
)

Source from the content-addressed store, hash-verified

59}
60
61async fn handle_slice(
62 local_vshard_id: u32,
63 payload: &[u8],
64 executor: &Arc<dyn ArrayLocalExecutor>,
65) -> Result<Vec<u8>> {
66 let req: ArrayShardSliceReq =
67 zerompk::from_msgpack(payload).map_err(|e| ClusterError::Codec {
68 detail: format!("ArrayShardSliceReq decode: {e}"),
69 })?;
70
71 validate_slice_routing(&req, local_vshard_id)?;
72
73 let rows = executor.exec_slice(&req).await?;
74
75 let truncated = req.limit > 0 && rows.len() >= req.limit as usize;
76 let resp = ArrayShardSliceResp {
77 shard_id: local_vshard_id,
78 rows_msgpack: rows,
79 truncated,
80 truncated_before_horizon: false,
81 };
82 serialise(resp)
83}
84
85async fn handle_agg(
86 local_vshard_id: u32,

Callers 1

handle_array_shard_rpcFunction · 0.85

Calls 4

validate_slice_routingFunction · 0.85
serialiseFunction · 0.85
exec_sliceMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected