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

Source from the content-addressed store, hash-verified

2223}
2224
2225int cbm_writer_append_nodes(cbm_db_writer_t *w, const CBMDumpNode *nodes, int count) {
2226 if (!w) {
2227 return CBM_NOT_FOUND;
2228 }
2229 if (w->err) {
2230 return w->err;
2231 }
2232 for (int i = 0; i < count; i++) {
2233 int rec_len;
2234 uint8_t *rec = build_node_record(&nodes[i], &rec_len);
2235 if (!rec) {
2236 w->err = ERR_WRITE_FAILED;
2237 return w->err;
2238 }
2239 /* prev_rowid is the previous node's id (0 for the very first), matching
2240 * the one-shot write_one_table loop — so output is byte-identical. */
2241 pb_add_table_cell_with_flush(&w->nodes_pb, nodes[i].id, rec, rec_len, w->last_node_rowid);
2242 free(rec);
2243 w->last_node_rowid = nodes[i].id;
2244 w->node_rows_written++;
2245 }
2246 return 0;
2247}
2248
2249int cbm_writer_finalize(cbm_db_writer_t *w, const char *project, const char *root_path,
2250 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