26#include <condition_variable>
31#include <shared_mutex>
107 std::shared_ptr<storage::job_repository> repo,
108 std::shared_ptr<remote_node_manager> node_manager,
109 std::shared_ptr<di::ILogger> logger =
nullptr);
121 std::shared_ptr<storage::job_repository> repo,
122 std::shared_ptr<remote_node_manager> node_manager,
123 std::shared_ptr<di::ILogger> logger =
nullptr);
152 std::string_view source_node_id,
153 std::string_view study_uid,
154 std::optional<std::string_view> series_uid = std::nullopt,
168 std::string_view destination_node_id,
169 const std::vector<std::string>& instance_uids,
184 std::string_view node_id,
185 std::string_view query_level,
186 const std::unordered_map<std::string, std::string>& query_keys,
200 std::string_view source_node_id,
201 std::optional<std::string_view> patient_id = std::nullopt,
215 std::string_view source_node_id,
216 std::string_view patient_id,
231 [[nodiscard]]
auto start_job(std::string_view job_id) -> kcenon::pacs::VoidResult;
239 [[nodiscard]]
auto pause_job(std::string_view job_id) -> kcenon::pacs::VoidResult;
247 [[nodiscard]]
auto resume_job(std::string_view job_id) -> kcenon::pacs::VoidResult;
257 [[nodiscard]]
auto cancel_job(std::string_view job_id) -> kcenon::pacs::VoidResult;
267 [[nodiscard]]
auto retry_job(std::string_view job_id) -> kcenon::pacs::VoidResult;
277 [[nodiscard]]
auto delete_job(std::string_view job_id) -> kcenon::pacs::VoidResult;
289 [[nodiscard]]
auto get_job(std::string_view job_id)
const
290 -> std::optional<job_record>;
302 std::optional<job_status> status = std::nullopt,
303 std::optional<job_type> type = std::nullopt,
305 size_t offset = 0) const -> std::vector<
job_record>;
390 [[nodiscard]] auto
is_running() const noexcept ->
bool;
Manager for asynchronous DICOM job execution.
auto pending_jobs() const -> size_t
Get number of pending jobs.
void set_progress_callback(job_progress_callback callback)
Set the progress callback.
auto is_running() const noexcept -> bool
Check if workers are running.
auto delete_job(std::string_view job_id) -> kcenon::pacs::VoidResult
Delete a job.
auto create_prefetch_job(std::string_view source_node_id, std::string_view patient_id, job_priority priority=job_priority::low) -> std::string
Create a prefetch job.
auto cancel_job(std::string_view job_id) -> kcenon::pacs::VoidResult
Cancel a job.
auto create_retrieve_job(std::string_view source_node_id, std::string_view study_uid, std::optional< std::string_view > series_uid=std::nullopt, job_priority priority=job_priority::normal) -> std::string
Create a retrieve job (C-MOVE/C-GET)
void start_workers()
Start the worker threads.
auto pause_job(std::string_view job_id) -> kcenon::pacs::VoidResult
Pause a running or queued job.
auto completed_jobs_today() const -> size_t
Get number of jobs completed today.
auto config() const noexcept -> const job_manager_config &
Get current configuration.
auto get_progress(std::string_view job_id) const -> job_progress
Get current progress for a job.
auto resume_job(std::string_view job_id) -> kcenon::pacs::VoidResult
Resume a paused job.
job_manager(job_manager &&)=delete
auto list_jobs_by_node(std::string_view node_id) const -> std::vector< job_record >
List jobs by node ID.
auto create_store_job(std::string_view destination_node_id, const std::vector< std::string > &instance_uids, job_priority priority=job_priority::normal) -> std::string
Create a store job (C-STORE)
job_manager(std::shared_ptr< storage::job_repository > repo, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< di::ILogger > logger=nullptr)
Construct a job manager with default configuration.
std::unique_ptr< impl > impl_
auto create_sync_job(std::string_view source_node_id, std::optional< std::string_view > patient_id=std::nullopt, job_priority priority=job_priority::low) -> std::string
Create a sync job.
auto create_query_job(std::string_view node_id, std::string_view query_level, const std::unordered_map< std::string, std::string > &query_keys, job_priority priority=job_priority::normal) -> std::string
Create a query job (C-FIND)
job_manager(const job_manager &)=delete
auto operator=(job_manager &&) -> job_manager &=delete
auto list_jobs(std::optional< job_status > status=std::nullopt, std::optional< job_type > type=std::nullopt, size_t limit=100, size_t offset=0) const -> std::vector< job_record >
List jobs with optional filters.
auto wait_for_completion(std::string_view job_id) -> std::future< job_record >
Wait for a job to complete.
auto active_jobs() const -> size_t
Get number of active (running) jobs.
~job_manager()
Destructor - stops workers if running.
void set_completion_callback(job_completion_callback callback)
Set the completion callback.
auto get_job(std::string_view job_id) const -> std::optional< job_record >
Get a job by ID.
auto operator=(const job_manager &) -> job_manager &=delete
auto start_job(std::string_view job_id) -> kcenon::pacs::VoidResult
Start a pending job.
auto failed_jobs_today() const -> size_t
Get number of jobs failed today.
auto retry_job(std::string_view job_id) -> kcenon::pacs::VoidResult
Retry a failed job.
void stop_workers()
Stop the worker threads.
Manager for remote PACS node connections.
Repository for job persistence (legacy SQLite interface)
Logger interface for dependency injection.
Job types and structures for asynchronous DICOM operations.
std::function< void( const std::string &job_id, const job_progress &progress)> job_progress_callback
Callback for job progress updates.
std::function< void( const std::string &job_id, const job_record &record)> job_completion_callback
Callback for job completion.
job_priority
Priority level for job execution.
@ low
Background operations.
@ normal
Standard priority.
Result<T> type aliases and helpers for PACS system.
Configuration for the job manager.
Progress tracking for a job.
Complete job record with all metadata.