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

Function build_node_indexes

internal/cbm/sqlite_writer.c:2048–2063  ·  view source on GitHub ↗

Build all 4 node index B-trees. Returns 0 on success, ERR_SORT_FAILED on failure. */

Source from the content-addressed store, hash-verified

2046
2047/* Build all 4 node index B-trees. Returns 0 on success, ERR_SORT_FAILED on failure. */
2048static int build_node_indexes(FILE *fp, uint32_t *next_page, CBMDumpNode *nodes, int node_count,
2049 SortJob *nsorts, uint32_t *label_root, uint32_t *name_root,
2050 uint32_t *file_root, uint32_t *qn_root) {
2051 *label_root =
2052 build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[0].perm, ncol_label);
2053 *name_root = build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_NAME].perm,
2054 ncol_name);
2055 *file_root = build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_FILE].perm,
2056 ncol_file);
2057 *qn_root =
2058 build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_QN].perm, ncol_qn);
2059 if (node_count > 0 && (!*label_root || !*name_root || !*file_root || !*qn_root)) {
2060 return ERR_SORT_FAILED;
2061 }
2062 return 0;
2063}
2064
2065/* Build all 7 edge index B-trees. Returns 0 on success, ERR_SORT_FAILED on failure. */
2066static int build_edge_indexes(FILE *fp, uint32_t *next_page, CBMDumpEdge *edges, int edge_count,

Callers 1

write_db_after_nodesFunction · 0.85

Calls 1

build_node_index_sortedFunction · 0.85

Tested by

no test coverage detected