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

Method batch_put

nodedb/src/engine/kv/engine.rs:254–280  ·  view source on GitHub ↗

BATCH PUT: insert/update multiple pairs. Returns count of new keys.

(
        &mut self,
        tenant_id: u64,
        collection: &str,
        entries: &[(Vec<u8>, Vec<u8>)],
        ttl_ms: u64,
        now_ms: u64,
    )

Source from the content-addressed store, hash-verified

252
253 /// BATCH PUT: insert/update multiple pairs. Returns count of new keys.
254 pub fn batch_put(
255 &mut self,
256 tenant_id: u64,
257 collection: &str,
258 entries: &[(Vec<u8>, Vec<u8>)],
259 ttl_ms: u64,
260 now_ms: u64,
261 ) -> usize {
262 let mut new_count = 0;
263 for (key, value) in entries {
264 if self
265 .put(
266 tenant_id,
267 collection,
268 key,
269 value,
270 ttl_ms,
271 now_ms,
272 Surrogate::ZERO,
273 )
274 .is_none()
275 {
276 new_count += 1;
277 }
278 }
279 new_count
280 }
281
282 /// SCAN: cursor-based iteration with optional key pattern matching and
283 /// index-accelerated predicate pushdown.

Callers 4

replay_kv_walMethod · 0.45
execute_kv_batch_putMethod · 0.45
batch_get_and_putFunction · 0.45

Calls 1

putMethod · 0.45

Tested by 1

batch_get_and_putFunction · 0.36