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

Function build_node_indexes

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

1988
1989/* Build all 4 node index B-trees. Returns 0 on success, ERR_SORT_FAILED on failure. */
1990static int build_node_indexes(FILE *fp, uint32_t *next_page, CBMDumpNode *nodes, int node_count,
1991 SortJob *nsorts, uint32_t *label_root, uint32_t *name_root,
1992 uint32_t *file_root, uint32_t *qn_root) {
1993 *label_root =
1994 build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[0].perm, ncol_label);
1995 *name_root = build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_NAME].perm,
1996 ncol_name);
1997 *file_root = build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_FILE].perm,
1998 ncol_file);
1999 *qn_root =
2000 build_node_index_sorted(fp, next_page, nodes, node_count, nsorts[NSORT_QN].perm, ncol_qn);
2001 if (node_count > 0 && (!*label_root || !*name_root || !*file_root || !*qn_root)) {
2002 return ERR_SORT_FAILED;
2003 }
2004 return 0;
2005}
2006
2007/* Build all 7 edge index B-trees. Returns 0 on success, ERR_SORT_FAILED on failure. */
2008static 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