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

Function build_node_indexes

internal/cbm/sqlite_writer.c:1913–1928  ·  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

1911
1912/* Build all 4 node index B-trees. Returns 0 on success, ERR_SORT_FAILED on failure. */
1913static int build_node_indexes(FILE *fp, uint32_t *next_page, CBMDumpNode *nodes, int node_count,
1914 SortJob *nsorts, uint32_t *label_root, uint32_t *name_root,
1915 uint32_t *file_root, uint32_t *qn_root) {
1916 *label_root =
1917 build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[0].perm, ncol_label);
1918 *name_root = build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_NAME].perm,
1919 ncol_name);
1920 *file_root = build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_FILE].perm,
1921 ncol_file);
1922 *qn_root =
1923 build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_QN].perm, ncol_qn);
1924 if (node_count > 0 && (!*label_root || !*name_root || !*file_root || !*qn_root)) {
1925 return ERR_SORT_FAILED;
1926 }
1927 return 0;
1928}
1929
1930/* Build all 7 edge index B-trees. Returns 0 on success, ERR_SORT_FAILED on failure. */
1931static 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