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

Function count_db_indexes

src/cli/cli.c:10595–10613  ·  view source on GitHub ↗

Count project index .db files in the cache directory (internal stores excluded). */

Source from the content-addressed store, hash-verified

10593
10594/* Count project index .db files in the cache directory (internal stores excluded). */
10595static int count_db_indexes(const char *home) {
10596 const char *cache_dir = get_cache_dir(home);
10597 if (!cache_dir) {
10598 return 0;
10599 }
10600 cbm_dir_t *d = cbm_opendir(cache_dir);
10601 if (!d) {
10602 return 0;
10603 }
10604 int count = 0;
10605 cbm_dirent_t *ent;
10606 while ((ent = cbm_readdir(d)) != NULL) {
10607 if (cbm_is_project_index_db(ent->name)) {
10608 count++;
10609 }
10610 }
10611 cbm_closedir(d);
10612 return count;
10613}
10614
10615/* Handle pre-existing indexes during (re)install (#607).
10616 *

Calls 5

get_cache_dirFunction · 0.85
cbm_opendirFunction · 0.85
cbm_readdirFunction · 0.85
cbm_is_project_index_dbFunction · 0.85
cbm_closedirFunction · 0.85

Tested by

no test coverage detected