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

Function doccand_project_db

tests/test_mcp.c:15309–15326  ·  view source on GitHub ↗

The one project DB in a private cache (not _config.db or activity.db), so * the test does not depend on how the server canonicalized the repo path. */

Source from the content-addressed store, hash-verified

15307/* The one project DB in a private cache (not _config.db or activity.db), so
15308 * the test does not depend on how the server canonicalized the repo path. */
15309static bool doccand_project_db(const char *cache, char *out, size_t out_size) {
15310 cbm_dir_t *d = cbm_opendir(cache);
15311 if (!d) {
15312 return false;
15313 }
15314 bool found = false;
15315 cbm_dirent_t *e;
15316 while (!found && (e = cbm_readdir(d)) != NULL) {
15317 size_t len = strlen(e->name);
15318 if (!e->is_dir && len > 3 && strcmp(e->name + len - 3, ".db") == 0 &&
15319 strcmp(e->name, "_config.db") != 0 && strcmp(e->name, "activity.db") != 0) {
15320 snprintf(out, out_size, "%s/%s", cache, e->name);
15321 found = true;
15322 }
15323 }
15324 cbm_closedir(d);
15325 return found;
15326}
15327
15328/* Remove the project DB (and its WAL/SHM) so the next index is a full one. */
15329static void doccand_clear(const char *cache) {

Callers 2

doccand_clearFunction · 0.85
doccand_rowsFunction · 0.85

Calls 3

cbm_opendirFunction · 0.85
cbm_readdirFunction · 0.85
cbm_closedirFunction · 0.85

Tested by

no test coverage detected