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

Function handle_array_shard_rpc

nodedb-cluster/src/distributed_array/handler.rs:41–59  ·  view source on GitHub ↗

Dispatch an incoming array shard RPC to the appropriate local handler. `opcode` is the `VShardMessageType` discriminant (u16). `local_vshard_id` is this shard's own vShard ID (for routing validation). `payload` is the zerompk-encoded request body. `executor` reaches into the local Data Plane array engine. Returns the zerompk-encoded response body on success, ready to be placed into a response `V

(
    opcode: u32,
    local_vshard_id: u32,
    payload: &[u8],
    executor: &Arc<dyn ArrayLocalExecutor>,
)

Source from the content-addressed store, hash-verified

39/// Returns the zerompk-encoded response body on success, ready to be placed
40/// into a response `VShardEnvelope`.
41pub async fn handle_array_shard_rpc(
42 opcode: u32,
43 local_vshard_id: u32,
44 payload: &[u8],
45 executor: &Arc<dyn ArrayLocalExecutor>,
46) -> Result<Vec<u8>> {
47 match opcode {
48 ARRAY_SHARD_SLICE_REQ => handle_slice(local_vshard_id, payload, executor).await,
49 ARRAY_SHARD_AGG_REQ => handle_agg(local_vshard_id, payload, executor).await,
50 ARRAY_SHARD_PUT_REQ => handle_put(local_vshard_id, payload, executor).await,
51 ARRAY_SHARD_DELETE_REQ => handle_delete(local_vshard_id, payload, executor).await,
52 ARRAY_SHARD_SURROGATE_BITMAP_REQ => {
53 handle_surrogate_bitmap(local_vshard_id, payload, executor).await
54 }
55 other => Err(ClusterError::Codec {
56 detail: format!("handle_array_shard_rpc: unknown opcode {other}"),
57 }),
58 }
59}
60
61async fn handle_slice(
62 local_vshard_id: u32,

Calls 5

handle_sliceFunction · 0.85
handle_aggFunction · 0.85
handle_putFunction · 0.85
handle_deleteFunction · 0.85
handle_surrogate_bitmapFunction · 0.85

Tested by

no test coverage detected