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

Function open_store_for_write

src/mcp/mcp.c:19821–19838  ·  view source on GitHub ↗

resolve_store opens file-backed projects query-only. A mutation must release * that reader before opening a dedicated writer because atomic publication uses * a self-contained DELETE-mode database that switches back to WAL on write. */

Source from the content-addressed store, hash-verified

19819 * that reader before opening a dedicated writer because atomic publication uses
19820 * a self-contained DELETE-mode database that switches back to WAL on write. */
19821static cbm_store_t *open_store_for_write(cbm_mcp_server_t *srv, cbm_store_t *resolved,
19822 cbm_store_t **owned_rw) {
19823 if (!srv || !resolved || !owned_rw) {
19824 return NULL;
19825 }
19826 const char *resolved_db_path = cbm_store_db_path(resolved);
19827 if (!resolved_db_path) {
19828 return resolved;
19829 }
19830 char *rw_path = heap_strdup(resolved_db_path);
19831 if (!rw_path) {
19832 return NULL;
19833 }
19834 invalidate_cached_store(srv);
19835 *owned_rw = cbm_store_open_path(rw_path);
19836 free(rw_path);
19837 return *owned_rw;
19838}
19839
19840/* Parsed `section_updates` for mode='set_sections'.
19841 *

Callers 2

handle_manage_adrFunction · 0.85
handle_ingest_tracesFunction · 0.85

Calls 4

cbm_store_db_pathFunction · 0.85
invalidate_cached_storeFunction · 0.85
cbm_store_open_pathFunction · 0.85
heap_strdupFunction · 0.70

Tested by

no test coverage detected