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:2302–2324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2300}
2301
2302int cbm_writer_append_nodes(cbm_db_writer_t *w, const CBMDumpNode *nodes, int count) {
2303 if (!w) {
2304 return CBM_NOT_FOUND;
2305 }
2306 if (w->err) {
2307 return w->err;
2308 }
2309 for (int i = 0; i < count; i++) {
2310 int rec_len;
2311 uint8_t *rec = build_node_record(&nodes[i], &rec_len);
2312 if (!rec) {
2313 w->err = ERR_WRITE_FAILED;
2314 return w->err;
2315 }
2316 /* prev_rowid is the previous node's id (0 for the very first), matching
2317 * the one-shot write_one_table loop — so output is byte-identical. */
2318 pb_add_table_cell_with_flush(&w->nodes_pb, nodes[i].id, rec, rec_len, w->last_node_rowid);
2319 free(rec);
2320 w->last_node_rowid = nodes[i].id;
2321 w->node_rows_written++;
2322 }
2323 return 0;
2324}
2325
2326int cbm_writer_finalize(cbm_db_writer_t *w, const char *project, const char *root_path,
2327 const char *indexed_at, CBMDumpNode *nodes, int node_count,

Callers 2

cbm_write_dbFunction · 0.85
cbm_gbuf_dump_to_sqliteFunction · 0.85

Calls 2

build_node_recordFunction · 0.85

Tested by

no test coverage detected