| 2434 | } |
| 2435 | |
| 2436 | int cbm_write_db(const char *path, const char *project, const char *root_path, |
| 2437 | const char *indexed_at, CBMDumpNode *nodes, int node_count, CBMDumpEdge *edges, |
| 2438 | int edge_count, CBMDumpVector *vectors, int vector_count, |
| 2439 | CBMDumpTokenVec *token_vecs, int token_vec_count) { |
| 2440 | /* One-shot = open + append all nodes in a single batch + finalize. |
| 2441 | * Produces byte-identical output to the former monolithic writer. */ |
| 2442 | cbm_db_writer_t *w = cbm_writer_open(path); |
| 2443 | if (!w) { |
| 2444 | return CBM_NOT_FOUND; |
| 2445 | } |
| 2446 | (void)cbm_writer_append_nodes(w, nodes, |
| 2447 | node_count); /* error recorded in w, handled by finalize */ |
| 2448 | return cbm_writer_finalize(w, project, root_path, indexed_at, nodes, node_count, edges, |
| 2449 | edge_count, vectors, vector_count, token_vecs, token_vec_count); |
| 2450 | } |