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

Method new

nodedb/src/engine/kv/slab.rs:38–48  ·  view source on GitHub ↗
(slot_size: usize, initial_slots: usize)

Source from the content-addressed store, hash-verified

36
37impl SlabTier {
38 fn new(slot_size: usize, initial_slots: usize) -> Self {
39 let buf = vec![0u8; slot_size * initial_slots];
40 let free_list: Vec<u32> = (0..initial_slots as u32).rev().collect();
41 Self {
42 slot_size,
43 buf,
44 total_slots: initial_slots,
45 free_list,
46 occupied: 0,
47 }
48 }
49
50 /// Allocate a slot. Returns the slot index, or None if the tier is full
51 /// (caller should grow the tier).

Callers

nothing calls this directly

Calls 2

collectMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected