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

Method execute_kv_batch_put

nodedb/src/data/executor/handlers/kv/batch.rs:46–71  ·  view source on GitHub ↗
(
        &mut self,
        task: &ExecutionTask,
        tid: u64,
        collection: &str,
        entries: &[(Vec<u8>, Vec<u8>)],
        ttl_ms: u64,
    )

Source from the content-addressed store, hash-verified

44 }
45
46 pub(in crate::data::executor) fn execute_kv_batch_put(
47 &mut self,
48 task: &ExecutionTask,
49 tid: u64,
50 collection: &str,
51 entries: &[(Vec<u8>, Vec<u8>)],
52 ttl_ms: u64,
53 ) -> Response {
54 debug!(core = self.core_id, %collection, count = entries.len(), "kv batch put");
55 let now_ms: u64 = self
56 .epoch_system_ms
57 .map(|ms| ms as u64)
58 .unwrap_or_else(current_ms);
59 let new_count = self
60 .kv_engine
61 .batch_put(tid, collection, entries, ttl_ms, now_ms);
62 match response_codec::encode_count("inserted", new_count) {
63 Ok(payload) => self.response_with_payload(task, payload),
64 Err(e) => self.response_error(
65 task,
66 ErrorCode::Internal {
67 detail: e.to_string(),
68 },
69 ),
70 }
71 }
72}

Callers 2

execute_kvMethod · 0.80
execute_tx_kvMethod · 0.80

Calls 5

encode_countFunction · 0.85
response_with_payloadMethod · 0.80
response_errorMethod · 0.80
to_stringMethod · 0.80
batch_putMethod · 0.45

Tested by

no test coverage detected