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

Function cbm_store_batch_count_degrees

src/store/store.c:3527–3557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3525}
3526
3527int cbm_store_batch_count_degrees(cbm_store_t *s, const int64_t *node_ids, int id_count,
3528 const char *edge_type, int *out_in, int *out_out) {
3529 if (!s || !node_ids || id_count <= 0 || !out_in || !out_out) {
3530 return CBM_STORE_ERR;
3531 }
3532
3533 memset(out_in, 0, (size_t)id_count * sizeof(int));
3534 memset(out_out, 0, (size_t)id_count * sizeof(int));
3535
3536 /* Build IN clause: (?,?,?) */
3537 char in_clause[CBM_SZ_4K];
3538 int pos = 0;
3539 for (int i = 0; i < id_count && pos < (int)sizeof(in_clause) - ST_IN_CLAUSE_MARGIN; i++) {
3540 if (i > 0) {
3541 in_clause[pos++] = ',';
3542 }
3543 in_clause[pos++] = '?';
3544 }
3545 in_clause[pos] = '\0';
3546
3547 bool has_type = edge_type && edge_type[0] != '\0';
3548
3549 int rc = count_degrees_direction(s, node_ids, id_count, in_clause, has_type, edge_type, true,
3550 out_in);
3551 if (rc != CBM_STORE_OK) {
3552 return rc;
3553 }
3554
3555 return count_degrees_direction(s, node_ids, id_count, in_clause, has_type, edge_type, false,
3556 out_out);
3557}
3558
3559/* ── UpsertFileHashBatch ───────────────────────────────────────── */
3560

Callers 3

handle_search_codeFunction · 0.85
cbm_layout_computeFunction · 0.85

Calls 1

count_degrees_directionFunction · 0.85

Tested by

no test coverage detected