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

Function cbm_writer_open

internal/cbm/sqlite_writer.c:2208–2223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2206};
2207
2208cbm_db_writer_t *cbm_writer_open(const char *path) {
2209 FILE *fp = fopen(path, "wb");
2210 if (!fp) {
2211 return NULL;
2212 }
2213 cbm_db_writer_t *w = (cbm_db_writer_t *)calloc(CBM_ALLOC_ONE, sizeof(*w));
2214 if (!w) {
2215 (void)fclose(fp);
2216 return NULL;
2217 }
2218 w->wc.fp = fp;
2219 w->wc.next_page = FIRST_DATA_PAGE;
2220 /* Nodes are never page 1 (page 1 is sqlite_master, written at finalize). */
2221 pb_init(&w->nodes_pb, fp, FIRST_DATA_PAGE, false);
2222 return w;
2223}
2224
2225int cbm_writer_append_nodes(cbm_db_writer_t *w, const CBMDumpNode *nodes, int count) {
2226 if (!w) {

Callers 2

cbm_write_dbFunction · 0.85
cbm_gbuf_dump_to_sqliteFunction · 0.85

Calls 1

pb_initFunction · 0.85

Tested by

no test coverage detected