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

Function cbm_store_node_degree

src/store/store.c:3325–3354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3323/* ── NodeDegree ────────────────────────────────────────────────── */
3324
3325void cbm_store_node_degree(cbm_store_t *s, int64_t node_id, int *in_deg, int *out_deg) {
3326 if (!s) {
3327 if (in_deg)
3328 *in_deg = 0;
3329 if (out_deg)
3330 *out_deg = 0;
3331 return;
3332 }
3333 *in_deg = 0;
3334 *out_deg = 0;
3335
3336 const char *in_sql = "SELECT COUNT(*) FROM edges WHERE target_id = ?1 AND type = 'CALLS'";
3337 sqlite3_stmt *stmt = NULL;
3338 if (sqlite3_prepare_v2(s->db, in_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) {
3339 sqlite3_bind_int64(stmt, SKIP_ONE, node_id);
3340 if (sqlite3_step(stmt) == SQLITE_ROW) {
3341 *in_deg = sqlite3_column_int(stmt, 0);
3342 }
3343 sqlite3_finalize(stmt);
3344 }
3345
3346 const char *out_sql = "SELECT COUNT(*) FROM edges WHERE source_id = ?1 AND type = 'CALLS'";
3347 if (sqlite3_prepare_v2(s->db, out_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) {
3348 sqlite3_bind_int64(stmt, SKIP_ONE, node_id);
3349 if (sqlite3_step(stmt) == SQLITE_ROW) {
3350 *out_deg = sqlite3_column_int(stmt, 0);
3351 }
3352 sqlite3_finalize(stmt);
3353 }
3354}
3355
3356/* ── List distinct file paths ────────────────────────────────── */
3357

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