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

Function resolve_store_fallback_scan

src/mcp/mcp.c:2468–2497  ·  view source on GitHub ↗

resolve_store_fallback_scan — see forward declaration above resolve_store. */

Source from the content-addressed store, hash-verified

2466
2467/* resolve_store_fallback_scan — see forward declaration above resolve_store. */
2468static cbm_store_t *resolve_store_fallback_scan(const char *project) {
2469 char dir_path[CBM_SZ_1K];
2470 cache_dir(dir_path, sizeof(dir_path));
2471 cbm_dir_t *d = cbm_opendir(dir_path);
2472 if (!d) {
2473 return NULL;
2474 }
2475 cbm_store_t *found = NULL;
2476 cbm_dirent_t *entry;
2477 while ((entry = cbm_readdir(d)) != NULL) {
2478 const char *n = entry->name;
2479 size_t len = strlen(n);
2480 if (!is_project_db_file(n, len)) {
2481 continue;
2482 }
2483 char full_path[CBM_SZ_2K];
2484 snprintf(full_path, sizeof(full_path), "%s/%s", dir_path, n);
2485 char iname[CBM_SZ_1K];
2486 cbm_store_t *st = NULL;
2487 if (db_internal_project_name(full_path, iname, sizeof(iname), &st)) {
2488 if (strcmp(iname, project) == 0) {
2489 found = st; /* adopt — caller takes ownership */
2490 break;
2491 }
2492 cbm_store_close(st);
2493 }
2494 }
2495 cbm_closedir(d);
2496 return found;
2497}
2498
2499/* Open a .db file briefly, collect node/edge counts and root_path,
2500 * then append a JSON entry to arr. */

Callers 1

resolve_store_internalFunction · 0.85

Calls 7

cache_dirFunction · 0.85
cbm_opendirFunction · 0.85
cbm_readdirFunction · 0.85
is_project_db_fileFunction · 0.85
db_internal_project_nameFunction · 0.85
cbm_store_closeFunction · 0.85
cbm_closedirFunction · 0.85

Tested by

no test coverage detected