MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / node_get

Function node_get

python/bplustree_c_src/node_ops.c:326–345  ·  view source on GitHub ↗

Get value from leaf node */

Source from the content-addressed store, hash-verified

324
325/* Get value from leaf node */
326PyObject* node_get(BPlusNode *node, PyObject *key) {
327 int pos = node_find_position(node, key);
328 if (pos < 0) return NULL; /* Comparison error */
329
330 if (pos < node->num_keys) {
331 PyObject *found_key = node_get_key(node, pos);
332 int cmp = fast_compare_eq(found_key, key);
333 if (cmp < 0) return NULL; /* Comparison error */
334
335 if (cmp) {
336 PyObject *value = node_get_value(node, pos);
337 Py_INCREF(value);
338 return value;
339 }
340 }
341
342 /* Key not found */
343 PyErr_SetObject(PyExc_KeyError, key);
344 return NULL;
345}
346
347/* Cache-aligned memory allocation functions */
348void* cache_aligned_alloc(size_t size) {

Callers 1

tree_getFunction · 0.85

Calls 4

node_find_positionFunction · 0.85
node_get_keyFunction · 0.85
fast_compare_eqFunction · 0.85
node_get_valueFunction · 0.85

Tested by

no test coverage detected