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

Function graph_capture_project

src/store/store.c:1915–1950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1913}
1914
1915static int graph_capture_project(cbm_store_t *store, const char *project,
1916 cbm_graph_compare_project_t *out) {
1917 cbm_project_t row = {0};
1918 int rc = cbm_store_get_project(store, project, &row);
1919 if (rc != CBM_STORE_OK) {
1920 return rc;
1921 }
1922 if (!row.name || !row.indexed_at || !row.root_path) {
1923 cbm_project_free_fields(&row);
1924 store_set_error(store, "compare project allocation failed");
1925 return CBM_STORE_ERR;
1926 }
1927
1928 snprintf(out->generation, sizeof(out->generation), "%s", safe_str(row.indexed_at));
1929 snprintf(out->index_mode, sizeof(out->index_mode), "unknown");
1930
1931 cbm_coverage_meta_t meta = {0};
1932 rc = cbm_store_coverage_meta_get(store, project, &meta);
1933 if (rc == CBM_STORE_OK) {
1934 snprintf(out->generation, sizeof(out->generation), "%s", safe_str(meta.generation));
1935 snprintf(out->index_mode, sizeof(out->index_mode), "%s", safe_str(meta.index_mode));
1936 cbm_store_coverage_meta_clear(&meta);
1937 } else if (rc != CBM_STORE_NOT_FOUND) {
1938 cbm_project_free_fields(&row);
1939 return rc;
1940 }
1941 cbm_project_free_fields(&row);
1942
1943 rc = graph_count_rows(store, "SELECT count(*) FROM nodes WHERE project=?1;", project,
1944 &out->node_count);
1945 if (rc != CBM_STORE_OK) {
1946 return rc;
1947 }
1948 return graph_count_rows(store, "SELECT count(*) FROM edges WHERE project=?1;", project,
1949 &out->edge_count);
1950}
1951
1952static int graph_node_cursor_step(cbm_store_t *store, graph_node_cursor_t *cursor) {
1953 int rc = sqlite3_step(cursor->stmt);

Callers 1

cbm_store_compare_graphsFunction · 0.85

Calls 7

cbm_store_get_projectFunction · 0.85
cbm_project_free_fieldsFunction · 0.85
store_set_errorFunction · 0.85
graph_count_rowsFunction · 0.85
safe_strFunction · 0.70

Tested by

no test coverage detected