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

Function cbm_store_node_degree

src/store/store.c:5958–5987  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5956/* ── NodeDegree ────────────────────────────────────────────────── */
5957
5958void cbm_store_node_degree(cbm_store_t *s, int64_t node_id, int *in_deg, int *out_deg) {
5959 if (!s) {
5960 if (in_deg)
5961 *in_deg = 0;
5962 if (out_deg)
5963 *out_deg = 0;
5964 return;
5965 }
5966 *in_deg = 0;
5967 *out_deg = 0;
5968
5969 const char *in_sql = "SELECT COUNT(*) FROM edges WHERE target_id = ?1 AND type = 'CALLS'";
5970 sqlite3_stmt *stmt = NULL;
5971 if (sqlite3_prepare_v2(s->db, in_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) {
5972 sqlite3_bind_int64(stmt, SKIP_ONE, node_id);
5973 if (sqlite3_step(stmt) == SQLITE_ROW) {
5974 *in_deg = sqlite3_column_int(stmt, 0);
5975 }
5976 sqlite3_finalize(stmt);
5977 }
5978
5979 const char *out_sql = "SELECT COUNT(*) FROM edges WHERE source_id = ?1 AND type = 'CALLS'";
5980 if (sqlite3_prepare_v2(s->db, out_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) {
5981 sqlite3_bind_int64(stmt, SKIP_ONE, node_id);
5982 if (sqlite3_step(stmt) == SQLITE_ROW) {
5983 *out_deg = sqlite3_column_int(stmt, 0);
5984 }
5985 sqlite3_finalize(stmt);
5986 }
5987}
5988
5989/* ── List distinct file paths ────────────────────────────────── */
5990

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