| 1263 | } |
| 1264 | |
| 1265 | cbm_watcher_project_status_t cbm_watcher_project_status(cbm_watcher_t *w, |
| 1266 | const char *project_name) { |
| 1267 | cbm_watcher_project_status_t status = {0}; |
| 1268 | if (!w) { |
| 1269 | return status; |
| 1270 | } |
| 1271 | cbm_mutex_lock(&w->projects_lock); |
| 1272 | project_state_t *project = project_name ? cbm_ht_get(w->projects, project_name) : NULL; |
| 1273 | status.registered = project && atomic_load_explicit(&project->registered, memory_order_acquire); |
| 1274 | status.running = atomic_load_explicit(&w->running, memory_order_acquire) && |
| 1275 | !atomic_load_explicit(&w->stopped, memory_order_acquire); |
| 1276 | cbm_mutex_unlock(&w->projects_lock); |
| 1277 | return status; |
| 1278 | } |
| 1279 | |
| 1280 | int cbm_watcher_index_failure_count(cbm_watcher_t *w, const char *project_name) { |
| 1281 | if (!w || !project_name) { |
no test coverage detected