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

Function observe_named_edge

tests/test_pipeline.c:1576–1607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1574} NamedEdgeObservation;
1575
1576static NamedEdgeObservation observe_named_edge(const char *repo_path, const char *db_name,
1577 const char *edge_type, const char *source_name,
1578 const char *target_name) {
1579 NamedEdgeObservation observation = {
1580 .run_rc = -1,
1581 .store_opened = false,
1582 .source_nodes = -1,
1583 .target_nodes = -1,
1584 .edge_count = -1,
1585 };
1586 char db_path[512];
1587 snprintf(db_path, sizeof(db_path), "%s/%s", repo_path, db_name);
1588 cbm_pipeline_t *pipeline = cbm_pipeline_new(repo_path, db_path, CBM_MODE_FULL);
1589 if (!pipeline) {
1590 return observation;
1591 }
1592 observation.run_rc = cbm_pipeline_run(pipeline);
1593 const char *project = cbm_pipeline_project_name(pipeline);
1594 cbm_store_t *store = cbm_store_open_path(db_path);
1595 observation.store_opened = store != NULL;
1596 if (store && project) {
1597 observation.source_nodes = named_node_count(store, project, source_name);
1598 observation.target_nodes = named_node_count(store, project, target_name);
1599 observation.edge_count =
1600 named_edge_count(store, project, edge_type, source_name, target_name);
1601 }
1602 if (store) {
1603 cbm_store_close(store);
1604 }
1605 cbm_pipeline_free(pipeline);
1606 return observation;
1607}
1608
1609/* env_accesses are extracted independently from calls and must materialize the
1610 * same EnvVar + CONFIGURES relationship in both pipeline implementations.

Callers 1

test_pipeline.cFile · 0.85

Calls 8

cbm_pipeline_newFunction · 0.85
cbm_pipeline_runFunction · 0.85
cbm_store_open_pathFunction · 0.85
named_node_countFunction · 0.85
named_edge_countFunction · 0.85
cbm_store_closeFunction · 0.85
cbm_pipeline_freeFunction · 0.85

Tested by

no test coverage detected