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:3426–3456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3424}
3425
3426int cbm_store_batch_count_degrees(cbm_store_t *s, const int64_t *node_ids, int id_count,
3427 const char *edge_type, int *out_in, int *out_out) {
3428 if (!s || !node_ids || id_count <= 0 || !out_in || !out_out) {
3429 return CBM_STORE_ERR;
3430 }
3431
3432 memset(out_in, 0, (size_t)id_count * sizeof(int));
3433 memset(out_out, 0, (size_t)id_count * sizeof(int));
3434
3435 /* Build IN clause: (?,?,?) */
3436 char in_clause[CBM_SZ_4K];
3437 int pos = 0;
3438 for (int i = 0; i < id_count && pos < (int)sizeof(in_clause) - ST_IN_CLAUSE_MARGIN; i++) {
3439 if (i > 0) {
3440 in_clause[pos++] = ',';
3441 }
3442 in_clause[pos++] = '?';
3443 }
3444 in_clause[pos] = '\0';
3445
3446 bool has_type = edge_type && edge_type[0] != '\0';
3447
3448 int rc = count_degrees_direction(s, node_ids, id_count, in_clause, has_type, edge_type, true,
3449 out_in);
3450 if (rc != CBM_STORE_OK) {
3451 return rc;
3452 }
3453
3454 return count_degrees_direction(s, node_ids, id_count, in_clause, has_type, edge_type, false,
3455 out_out);
3456}
3457
3458/* ── UpsertFileHashBatch ───────────────────────────────────────── */
3459

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