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

Function build_edge_indexes

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

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,
1932 SortJob *esorts, uint32_t *source_root, uint32_t *target_root,
1933 uint32_t *type_root, uint32_t *tgt_type_root, uint32_t *src_type_root,
1934 uint32_t *url_path_root, uint32_t *auto_root) {
1935 *source_root =
1936 build_edge_index_sorted(fp, next_page, edges, edge_count, esorts[0].perm, ecell_source);
1937 *target_root = build_edge_index_sorted(fp, next_page, edges, edge_count,
1938 esorts[ESORT_TARGET].perm, ecell_target);
1939 *type_root = build_edge_index_sorted(fp, next_page, edges, edge_count, esorts[ESORT_TYPE].perm,
1940 ecell_type);
1941 *tgt_type_root = build_edge_index_sorted(
1942 fp, next_page, edges, edge_count, esorts[ESORT_PROJ_TGT_TYPE].perm, ecell_proj_target_type);
1943 *src_type_root = build_edge_index_sorted(
1944 fp, next_page, edges, edge_count, esorts[ESORT_PROJ_SRC_TYPE].perm, ecell_proj_source_type);
1945 *url_path_root = build_edge_index_sorted(fp, next_page, edges, edge_count,
1946 esorts[ESORT_URL_PATH].perm, ecell_url_path);
1947 *auto_root = build_edge_index_sorted(fp, next_page, edges, edge_count,
1948 esorts[ESORT_SRC_TGT_TYPE].perm, ecell_src_tgt_type);
1949 if (edge_count > 0 && (!*source_root || !*target_root || !*type_root || !*tgt_type_root ||
1950 !*src_type_root || !*url_path_root || !*auto_root)) {
1951 return ERR_SORT_FAILED;
1952 }
1953 return 0;
1954}
1955
1956/* Launch parallel sort threads for all index permutations. */
1957static 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