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

Function coord_put

nodedb-cluster/src/distributed_array/coordinator/write.rs:88–118  ·  view source on GitHub ↗

Partition a flat cell list by Hilbert tile and fan out to owning shards. `cells` — each element is `(hilbert_prefix, zerompk-encoded single-cell bytes)`. The Hilbert prefix is computed by the caller (the Control Plane planner) from the cell's coord tuple and the array schema; this function does not decode cell bytes. `prefix_bits` — routing granularity (1–16) from the array catalog entry. `wal_l

(
    params: &ArrayWriteCoordParams,
    array_id_msgpack: Vec<u8>,
    prefix_bits: u8,
    wal_lsn: u64,
    cells: &[(u64, Vec<u8>)],
    dispatch: &Arc<dyn ShardRpcDispatch>,
    circuit_breaker:

Source from the content-addressed store, hash-verified

86/// is committed independently. A partial failure returns the first error encountered;
87/// cells that were already committed to other shards are not rolled back.
88pub async fn coord_put(
89 params: &ArrayWriteCoordParams,
90 array_id_msgpack: Vec<u8>,
91 prefix_bits: u8,
92 wal_lsn: u64,
93 cells: &[(u64, Vec<u8>)],
94 dispatch: &Arc<dyn ShardRpcDispatch>,
95 circuit_breaker: &Arc<CircuitBreaker>,
96) -> Result<Vec<ArrayShardPutResp>> {
97 if cells.is_empty() {
98 return Ok(Vec::new());
99 }
100
101 let buckets = partition_put_cells(cells, prefix_bits)?;
102
103 let per_shard: Vec<(u32, ArrayShardPutReq)> = buckets
104 .into_iter()
105 .map(|b| {
106 let req = ArrayShardPutReq {
107 array_id_msgpack: array_id_msgpack.clone(),
108 cells_msgpack: b.cells_msgpack,
109 wal_lsn,
110 representative_hilbert_prefix: b.representative_hilbert_prefix,
111 prefix_bits,
112 };
113 (b.vshard_id, req)
114 })
115 .collect();
116
117 coord_put_partitioned(params, per_shard, dispatch, circuit_breaker).await
118}
119
120/// Partition a flat coord list by Hilbert tile and fan delete requests to owning shards.
121///

Callers 3

execute_putMethod · 0.85

Calls 5

partition_put_cellsFunction · 0.85
coord_put_partitionedFunction · 0.85
collectMethod · 0.80
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected