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

Function cbm_writer_append_nodes

internal/cbm/sqlite_writer.c:2369–2393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2367}
2368
2369int cbm_writer_append_nodes(cbm_db_writer_t *w, const CBMDumpNode *nodes, int count) {
2370 if (!w) {
2371 return CBM_NOT_FOUND;
2372 }
2373 if (w->err) {
2374 return w->err;
2375 }
2376 for (int i = 0; i < count; i++) {
2377 RecordBuilder r;
2378 rec_init(&r);
2379 fill_node_record(&r, &nodes[i]);
2380 /* prev_rowid is the previous node's id (0 for the very first), matching
2381 * the one-shot write_one_table loop — so output is byte-identical. */
2382 bool placed =
2383 pb_add_table_record_with_flush(&w->nodes_pb, nodes[i].id, &r, w->last_node_rowid);
2384 rec_free(&r);
2385 if (!placed) {
2386 w->err = ERR_WRITE_FAILED;
2387 return w->err;
2388 }
2389 w->last_node_rowid = nodes[i].id;
2390 w->node_rows_written++;
2391 }
2392 return 0;
2393}
2394
2395int cbm_writer_finalize(cbm_db_writer_t *w, const char *project, const char *root_path,
2396 const char *indexed_at, CBMDumpNode *nodes, int node_count,

Callers 2

cbm_write_dbFunction · 0.85
cbm_gbuf_dump_to_sqliteFunction · 0.85

Calls 4

rec_initFunction · 0.85
fill_node_recordFunction · 0.85
rec_freeFunction · 0.85

Tested by

no test coverage detected