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

Function build_edge_indexes

internal/cbm/sqlite_writer.c:2066–2089  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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,
2067 SortJob *esorts, uint32_t *source_root, uint32_t *target_root,
2068 uint32_t *type_root, uint32_t *tgt_type_root, uint32_t *src_type_root,
2069 uint32_t *url_path_root, uint32_t *auto_root) {
2070 *source_root =
2071 build_edge_index_sorted(fp, next_page, edges, edge_count, esorts[0].perm, ecell_source);
2072 *target_root = build_edge_index_sorted(fp, next_page, edges, edge_count,
2073 esorts[ESORT_TARGET].perm, ecell_target);
2074 *type_root = build_edge_index_sorted(fp, next_page, edges, edge_count, esorts[ESORT_TYPE].perm,
2075 ecell_type);
2076 *tgt_type_root = build_edge_index_sorted(
2077 fp, next_page, edges, edge_count, esorts[ESORT_PROJ_TGT_TYPE].perm, ecell_proj_target_type);
2078 *src_type_root = build_edge_index_sorted(
2079 fp, next_page, edges, edge_count, esorts[ESORT_PROJ_SRC_TYPE].perm, ecell_proj_source_type);
2080 *url_path_root = build_edge_index_sorted(fp, next_page, edges, edge_count,
2081 esorts[ESORT_URL_PATH].perm, ecell_url_path);
2082 *auto_root = build_edge_index_sorted(fp, next_page, edges, edge_count,
2083 esorts[ESORT_SRC_TGT_TYPE].perm, ecell_src_tgt_type);
2084 if (edge_count > 0 && (!*source_root || !*target_root || !*type_root || !*tgt_type_root ||
2085 !*src_type_root || !*url_path_root || !*auto_root)) {
2086 return ERR_SORT_FAILED;
2087 }
2088 return 0;
2089}
2090
2091/* Launch parallel sort threads for all index permutations. */
2092static void parallel_sort_indexes(SortJob *nsorts, int n_node, SortJob *esorts, int n_edge) {

Callers 1

write_db_after_nodesFunction · 0.85

Calls 1

build_edge_index_sortedFunction · 0.85

Tested by

no test coverage detected