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