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

Function cbm_store_node_degree

src/store/store.c:1938–1967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1936/* ── NodeDegree ────────────────────────────────────────────────── */
1937
1938void cbm_store_node_degree(cbm_store_t *s, int64_t node_id, int *in_deg, int *out_deg) {
1939 if (!s) {
1940 if (in_deg)
1941 *in_deg = 0;
1942 if (out_deg)
1943 *out_deg = 0;
1944 return;
1945 }
1946 *in_deg = 0;
1947 *out_deg = 0;
1948
1949 const char *in_sql = "SELECT COUNT(*) FROM edges WHERE target_id = ?1 AND type = 'CALLS'";
1950 sqlite3_stmt *stmt = NULL;
1951 if (sqlite3_prepare_v2(s->db, in_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) {
1952 sqlite3_bind_int64(stmt, SKIP_ONE, node_id);
1953 if (sqlite3_step(stmt) == SQLITE_ROW) {
1954 *in_deg = sqlite3_column_int(stmt, 0);
1955 }
1956 sqlite3_finalize(stmt);
1957 }
1958
1959 const char *out_sql = "SELECT COUNT(*) FROM edges WHERE source_id = ?1 AND type = 'CALLS'";
1960 if (sqlite3_prepare_v2(s->db, out_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) {
1961 sqlite3_bind_int64(stmt, SKIP_ONE, node_id);
1962 if (sqlite3_step(stmt) == SQLITE_ROW) {
1963 *out_deg = sqlite3_column_int(stmt, 0);
1964 }
1965 sqlite3_finalize(stmt);
1966 }
1967}
1968
1969/* ── List distinct file paths ────────────────────────────────── */
1970

Callers 4

node_propFunction · 0.85
build_snippet_responseFunction · 0.85
test_store_nodes.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected