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

Function cbm_store_upsert_node_batch

src/store/store.c:2136–2155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2134/* ── Node batch ─────────────────────────────────────────────────── */
2135
2136int cbm_store_upsert_node_batch(cbm_store_t *s, const cbm_node_t *nodes, int count,
2137 int64_t *out_ids) {
2138 if (count == 0) {
2139 return CBM_STORE_OK;
2140 }
2141
2142 exec_sql(s, "BEGIN IMMEDIATE;");
2143 for (int i = 0; i < count; i++) {
2144 int64_t id = cbm_store_upsert_node(s, &nodes[i]);
2145 if (id == CBM_STORE_ERR) {
2146 exec_sql(s, "ROLLBACK;");
2147 return CBM_STORE_ERR;
2148 }
2149 if (out_ids) {
2150 out_ids[i] = id;
2151 }
2152 }
2153 exec_sql(s, "COMMIT;");
2154 return CBM_STORE_OK;
2155}
2156
2157/* ── Edge CRUD ──────────────────────────────────────────────────── */
2158

Callers 1

test_store_nodes.cFile · 0.85

Calls 2

exec_sqlFunction · 0.85
cbm_store_upsert_nodeFunction · 0.85

Tested by

no test coverage detected