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

Method grow

nodedb/src/engine/kv/slab.rs:70–79  ·  view source on GitHub ↗

Grow the tier by doubling its capacity.

(&mut self)

Source from the content-addressed store, hash-verified

68
69 /// Grow the tier by doubling its capacity.
70 fn grow(&mut self) {
71 let new_slots = self.total_slots;
72 let old_total = self.total_slots;
73 self.total_slots += new_slots;
74 self.buf.resize(self.total_slots * self.slot_size, 0);
75 // Push new slot indices onto the free list (reverse order for stack semantics).
76 for i in (old_total..self.total_slots).rev() {
77 self.free_list.push(i as u32);
78 }
79 }
80
81 /// Free a slot by index.
82 fn free(&mut self, slot_idx: u32) {

Callers 1

allocMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected