| 359 | } |
| 360 | |
| 361 | static int application_worker_start_default(void *context, const char *args_json, |
| 362 | size_t memory_budget_bytes, const char *marker_file, |
| 363 | const char *quarantine_file, |
| 364 | cbm_daemon_application_worker_t *worker_out) { |
| 365 | (void)context; |
| 366 | application_default_worker_t *worker = cbm_calloc(CBM_MEM_CLASS_OTHER, sizeof(*worker)); |
| 367 | if (!worker) { |
| 368 | return -1; |
| 369 | } |
| 370 | yyjson_doc *args_doc = yyjson_read_opts((char *)args_json, strlen(args_json), 0, |
| 371 | cbm_json_writer_allocator(), NULL); |
| 372 | const char *root = yyjson_get_str(yyjson_obj_get(yyjson_doc_get_root(args_doc), "repo_path")); |
| 373 | worker->project = application_index_project_key(root, args_json); |
| 374 | yyjson_doc_free(args_doc); |
| 375 | int result = cbm_index_worker_start_with_log(args_json, memory_budget_bytes, false, marker_file, |
| 376 | quarantine_file, application_worker_diagnostic, |
| 377 | worker, &worker->handle); |
| 378 | if (result != 0) { |
| 379 | application_worker_destroy_default(NULL, worker); |
| 380 | *worker_out = NULL; |
| 381 | return result; |
| 382 | } |
| 383 | *worker_out = worker; |
| 384 | return 0; |
| 385 | } |
| 386 | |
| 387 | static cbm_index_worker_poll_t application_worker_poll_default( |
| 388 | void *context, cbm_daemon_application_worker_t opaque, |
nothing calls this directly
no test coverage detected