MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_work_note_ht

Function cbm_work_note_ht

src/foundation/mem_events.c:1434–1460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1432}
1433
1434void cbm_work_note_ht(cbm_work_kind_t kind, void *site, const void *table, const char *key,
1435 uint64_t generation, bool hit) {
1436 if (!cbm_memev_enabled()) {
1437 return;
1438 }
1439 tl_state_t *st = tl_get();
1440 if (!st || st->busy) {
1441 return;
1442 }
1443 st->busy = true;
1444 uint64_t repeat = 0;
1445 if (kind == CBM_WORK_HT_GET) {
1446 uint64_t key_hash = path_hash(key);
1447 ht_pair_t *slot =
1448 &st->ht_cache[mix((uint64_t)(uintptr_t)table ^ (key_hash * 0x9e3779b97f4a7c15ULL)) &
1449 (MEMEV_REPEAT_SLOTS - 1)];
1450 repeat =
1451 (slot->table == table && slot->key_hash == key_hash && slot->generation == generation)
1452 ? 1
1453 : 0;
1454 slot->table = table;
1455 slot->key_hash = key_hash;
1456 slot->generation = generation;
1457 }
1458 work_add(st, kind, (uintptr_t)site, 0, (kind == CBM_WORK_HT_GET && !hit) ? 1 : 0, 0, repeat);
1459 st->busy = false;
1460}
1461
1462/* ── merge ────────────────────────────────────────────────────────────*/
1463static void flush_state(tl_state_t *st) {

Callers 2

hash_table.cFile · 0.85
test_mem_events.cFile · 0.85

Calls 5

cbm_memev_enabledFunction · 0.85
tl_getFunction · 0.85
path_hashFunction · 0.85
mixFunction · 0.85
work_addFunction · 0.85

Tested by

no test coverage detected