|
PACS System 0.1.0
PACS DICOM system library
|
#include <sync_manager.h>

Classes | |
| struct | impl |
Public Member Functions | |
| sync_manager (sync_repositories repositories, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::query_scu > query_scu, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a sync manager from split repositories. | |
| sync_manager (const sync_manager_config &config, sync_repositories repositories, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::query_scu > query_scu, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a sync manager from split repositories with custom configuration. | |
| sync_manager (std::shared_ptr< storage::sync_repository > repo, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::query_scu > query_scu, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a sync manager with default configuration. | |
| sync_manager (const sync_manager_config &config, std::shared_ptr< storage::sync_repository > repo, std::shared_ptr< remote_node_manager > node_manager, std::shared_ptr< job_manager > job_manager, std::shared_ptr< services::query_scu > query_scu, std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct a sync manager with custom configuration. | |
| ~sync_manager () | |
| Destructor - stops scheduler if running. | |
| sync_manager (const sync_manager &)=delete | |
| auto | operator= (const sync_manager &) -> sync_manager &=delete |
| sync_manager (sync_manager &&)=delete | |
| auto | operator= (sync_manager &&) -> sync_manager &=delete |
| auto | add_config (const sync_config &config) -> kcenon::pacs::VoidResult |
| Add a new sync configuration. | |
| auto | update_config (const sync_config &config) -> kcenon::pacs::VoidResult |
| Update an existing sync configuration. | |
| auto | remove_config (std::string_view config_id) -> kcenon::pacs::VoidResult |
| Remove a sync configuration. | |
| auto | get_config (std::string_view config_id) const -> std::optional< sync_config > |
| Get a sync configuration by ID. | |
| auto | list_configs () const -> std::vector< sync_config > |
| List all sync configurations. | |
| auto | sync_now (std::string_view config_id) -> std::string |
| Start sync immediately for a configuration. | |
| auto | full_sync (std::string_view config_id) -> std::string |
| Perform a full sync for a configuration. | |
| auto | incremental_sync (std::string_view config_id) -> std::string |
| Perform an incremental sync for a configuration. | |
| auto | wait_for_sync (std::string_view job_id) -> std::future< sync_result > |
| Wait for a sync operation to complete. | |
| auto | compare (std::string_view config_id) -> sync_result |
| Compare local and remote data without syncing. | |
| auto | compare_async (std::string_view config_id) -> std::future< sync_result > |
| Compare local and remote data asynchronously. | |
| auto | get_conflicts () const -> std::vector< sync_conflict > |
| Get all unresolved conflicts. | |
| auto | get_conflicts (std::string_view config_id) const -> std::vector< sync_conflict > |
| Get unresolved conflicts for a specific configuration. | |
| auto | resolve_conflict (std::string_view study_uid, conflict_resolution resolution) -> kcenon::pacs::VoidResult |
| Resolve a specific conflict. | |
| auto | resolve_all_conflicts (std::string_view config_id, conflict_resolution resolution) -> kcenon::pacs::VoidResult |
| Resolve all conflicts for a configuration. | |
| void | start_scheduler () |
| Start the sync scheduler. | |
| void | stop_scheduler () |
| Stop the sync scheduler. | |
| auto | is_scheduler_running () const noexcept -> bool |
| Check if scheduler is running. | |
| auto | is_syncing (std::string_view config_id) const -> bool |
| Check if a sync is currently running for a configuration. | |
| auto | get_last_result (std::string_view config_id) const -> sync_result |
| Get the last sync result for a configuration. | |
| auto | get_statistics () const -> sync_statistics |
| Get overall sync statistics. | |
| auto | get_statistics (std::string_view config_id) const -> sync_statistics |
| Get statistics for a specific configuration. | |
| void | set_progress_callback (sync_progress_callback callback) |
| Set callback for sync progress updates. | |
| void | set_completion_callback (sync_completion_callback callback) |
| Set callback for sync completion. | |
| void | set_conflict_callback (sync_conflict_callback callback) |
| Set callback for conflict detection. | |
| auto | config () const noexcept -> const sync_manager_config & |
| Get current manager configuration. | |
Private Attributes | |
| std::unique_ptr< impl > | impl_ |
Definition at line 102 of file sync_manager.h.
|
explicit |
Construct a sync manager from split repositories.
| repositories | Split sync repositories for configs, conflicts, and history |
| node_manager | Remote node manager (required) |
| job_manager | Job manager for async operations (required) |
| query_scu | Query SCU for study comparisons (required) |
| logger | Logger instance (optional) |
Definition at line 733 of file sync_manager.cpp.
|
explicit |
Construct a sync manager from split repositories with custom configuration.
| config | Manager configuration |
| repositories | Split sync repositories for configs, conflicts, and history |
| node_manager | Remote node manager (required) |
| job_manager | Job manager for async operations (required) |
| query_scu | Query SCU for study comparisons (required) |
| logger | Logger instance (optional) |
Definition at line 743 of file sync_manager.cpp.
References config(), kcenon::pacs::client::sync_manager::impl::config, impl_, kcenon::pacs::client::sync_manager::impl::job_mgr, kcenon::pacs::client::sync_manager::impl::load_configs_from_repo(), kcenon::pacs::client::sync_manager::impl::load_conflicts_from_repo(), kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::client::sync_manager::impl::node_manager, kcenon::pacs::di::null_logger(), kcenon::pacs::client::sync_manager::impl::query_scu, and kcenon::pacs::client::sync_manager::impl::repositories.

|
explicit |
Construct a sync manager with default configuration.
Compatibility-only overload. Prefer split repositories for new wiring.
| repo | Sync repository for persistence (required) |
| node_manager | Remote node manager (required) |
| job_manager | Job manager for async operations (required) |
| query_scu | Query SCU for study comparisons (required) |
| logger | Logger instance (optional) |
Definition at line 763 of file sync_manager.cpp.
|
explicit |
Construct a sync manager with custom configuration.
Compatibility-only overload. Prefer split repositories for new wiring.
| config | Manager configuration |
| repo | Sync repository for persistence (required) |
| node_manager | Remote node manager (required) |
| job_manager | Job manager for async operations (required) |
| query_scu | Query SCU for study comparisons (required) |
| logger | Logger instance (optional) |
Definition at line 773 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::compatibility_repo, config(), kcenon::pacs::client::sync_manager::impl::config, impl_, kcenon::pacs::client::sync_manager::impl::job_mgr, kcenon::pacs::client::sync_manager::impl::load_configs_from_repo(), kcenon::pacs::client::sync_manager::impl::load_conflicts_from_repo(), kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::client::sync_manager::impl::node_manager, kcenon::pacs::di::null_logger(), and kcenon::pacs::client::sync_manager::impl::query_scu.

| kcenon::pacs::client::sync_manager::~sync_manager | ( | ) |
Destructor - stops scheduler if running.
Definition at line 793 of file sync_manager.cpp.
References stop_scheduler().

|
delete |
|
delete |
|
nodiscard |
Add a new sync configuration.
| config | The configuration to add |
Definition at line 801 of file sync_manager.cpp.
References config(), kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), impl_, kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::pacs_void_error(), and kcenon::pacs::client::sync_manager::impl::save_config().

|
nodiscard |
Compare local and remote data without syncing.
Returns a sync_result showing what would be synced.
| config_id | The configuration ID to compare |
Definition at line 959 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::compare_with_local(), kcenon::pacs::client::sync_result::completed_at, kcenon::pacs::client::sync_result::config_id, kcenon::pacs::client::sync_result::conflicts, kcenon::pacs::client::sync_result::elapsed, kcenon::pacs::client::sync_result::errors, kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), impl_, kcenon::pacs::client::sync_manager::impl::query_remote_studies(), kcenon::pacs::client::sync_result::started_at, kcenon::pacs::client::sync_result::studies_checked, and kcenon::pacs::client::sync_result::success.
Referenced by compare_async().


|
nodiscard |
Compare local and remote data asynchronously.
| config_id | The configuration ID to compare |
Definition at line 996 of file sync_manager.cpp.
References compare().

|
nodiscardnoexcept |
Get current manager configuration.
Definition at line 1225 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::config, and impl_.
Referenced by add_config(), sync_manager(), sync_manager(), and update_config().

|
nodiscard |
Perform a full sync for a configuration.
Syncs all data within the lookback period, ignoring last sync time.
| config_id | The configuration ID to sync |
Definition at line 915 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), impl_, kcenon::pacs::client::sync_manager::impl::mark_sync_active(), kcenon::pacs::client::sync_manager::impl::mark_sync_inactive(), kcenon::pacs::client::sync_manager::impl::notify_completion(), and kcenon::pacs::client::sync_manager::impl::perform_sync().
Referenced by kcenon::pacs::client::sync_manager::impl::perform_sync().


|
nodiscard |
Get a sync configuration by ID.
| config_id | The configuration ID to retrieve |
Definition at line 884 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), and impl_.

|
nodiscard |
Get all unresolved conflicts.
Definition at line 1006 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::conflicts, kcenon::pacs::client::sync_manager::impl::conflicts_mutex, and impl_.
|
nodiscard |
Get unresolved conflicts for a specific configuration.
| config_id | The configuration ID |
Definition at line 1015 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::conflicts, kcenon::pacs::client::sync_manager::impl::conflicts_mutex, and impl_.
|
nodiscard |
Get the last sync result for a configuration.
| config_id | The configuration ID |
Definition at line 1152 of file sync_manager.cpp.
References impl_, kcenon::pacs::client::sync_manager::impl::last_results, and kcenon::pacs::client::sync_manager::impl::results_mutex.
|
nodiscard |
Get overall sync statistics.
Definition at line 1165 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::failed_syncs, impl_, kcenon::pacs::client::sync_manager::impl::successful_syncs, kcenon::pacs::client::sync_manager::impl::total_bytes_transferred, kcenon::pacs::client::sync_manager::impl::total_conflicts_detected, kcenon::pacs::client::sync_manager::impl::total_conflicts_resolved, kcenon::pacs::client::sync_manager::impl::total_studies_synced, and kcenon::pacs::client::sync_manager::impl::total_syncs.
|
nodiscard |
Get statistics for a specific configuration.
| config_id | The configuration ID |
Definition at line 1177 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::conflicts, kcenon::pacs::client::sync_manager::impl::conflicts_mutex, kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), and impl_.

|
nodiscard |
Perform an incremental sync for a configuration.
Only syncs data modified since the last successful sync.
| config_id | The configuration ID to sync |
Definition at line 929 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), impl_, kcenon::pacs::client::sync_manager::impl::mark_sync_active(), kcenon::pacs::client::sync_manager::impl::mark_sync_inactive(), kcenon::pacs::client::sync_manager::impl::notify_completion(), and kcenon::pacs::client::sync_manager::impl::perform_sync().

|
nodiscardnoexcept |
Check if scheduler is running.
Definition at line 1140 of file sync_manager.cpp.
References impl_, and kcenon::pacs::client::sync_manager::impl::scheduler_running.
|
nodiscard |
Check if a sync is currently running for a configuration.
| config_id | The configuration ID to check |
Definition at line 1148 of file sync_manager.cpp.
References impl_, and kcenon::pacs::client::sync_manager::impl::is_sync_active().

|
nodiscard |
List all sync configurations.
Definition at line 888 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::configs, kcenon::pacs::client::sync_manager::impl::configs_mutex, and impl_.
|
delete |
|
delete |
|
nodiscard |
Remove a sync configuration.
| config_id | The ID of the configuration to remove |
Definition at line 847 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::compatibility_repo, kcenon::pacs::client::sync_manager::impl::configs, kcenon::pacs::client::sync_repositories::configs, kcenon::pacs::client::sync_manager::impl::configs_mutex, impl_, kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::pacs_void_error(), and kcenon::pacs::client::sync_manager::impl::repositories.

|
nodiscard |
Resolve all conflicts for a configuration.
| config_id | The configuration ID |
| resolution | How to resolve all conflicts |
Definition at line 1074 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::conflicts, kcenon::pacs::client::sync_manager::impl::conflicts_mutex, impl_, kcenon::pacs::client::sync_manager::impl::logger, resolve_conflict(), and uid.

|
nodiscard |
Resolve a specific conflict.
| study_uid | The Study Instance UID of the conflict |
| resolution | How to resolve the conflict |
Definition at line 1026 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::compatibility_repo, kcenon::pacs::client::sync_manager::impl::conflicts, kcenon::pacs::client::sync_repositories::conflicts, kcenon::pacs::client::sync_manager::impl::conflicts_mutex, impl_, kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::pacs_void_error(), kcenon::pacs::client::sync_manager::impl::repositories, kcenon::pacs::client::sync_manager::impl::resolve_conflict_internal(), and kcenon::pacs::client::to_string().
Referenced by resolve_all_conflicts().


| void kcenon::pacs::client::sync_manager::set_completion_callback | ( | sync_completion_callback | callback | ) |
Set callback for sync completion.
| callback | The callback function |
Definition at line 1211 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::callbacks_mutex, kcenon::pacs::client::sync_manager::impl::completion_callback, and impl_.
| void kcenon::pacs::client::sync_manager::set_conflict_callback | ( | sync_conflict_callback | callback | ) |
Set callback for conflict detection.
| callback | The callback function |
Definition at line 1216 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::callbacks_mutex, kcenon::pacs::client::sync_manager::impl::conflict_callback, and impl_.
| void kcenon::pacs::client::sync_manager::set_progress_callback | ( | sync_progress_callback | callback | ) |
Set callback for sync progress updates.
| callback | The callback function |
Definition at line 1206 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::callbacks_mutex, impl_, and kcenon::pacs::client::sync_manager::impl::progress_callback.
| void kcenon::pacs::client::sync_manager::start_scheduler | ( | ) |
Start the sync scheduler.
Schedules syncs based on each config's schedule_cron setting.
Definition at line 1108 of file sync_manager.cpp.
References impl_, kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::client::sync_manager::impl::scheduler_loop(), kcenon::pacs::client::sync_manager::impl::scheduler_running, and kcenon::pacs::client::sync_manager::impl::scheduler_thread.

| void kcenon::pacs::client::sync_manager::stop_scheduler | ( | ) |
Stop the sync scheduler.
Definition at line 1123 of file sync_manager.cpp.
References impl_, kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::client::sync_manager::impl::scheduler_cv, kcenon::pacs::client::sync_manager::impl::scheduler_running, and kcenon::pacs::client::sync_manager::impl::scheduler_thread.
Referenced by ~sync_manager().

|
nodiscard |
Start sync immediately for a configuration.
Uses the config's existing settings (incremental or full based on last_sync).
| config_id | The configuration ID to sync |
Definition at line 897 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), impl_, kcenon::pacs::client::sync_manager::impl::mark_sync_active(), kcenon::pacs::client::sync_manager::impl::mark_sync_inactive(), kcenon::pacs::client::sync_manager::impl::notify_completion(), and kcenon::pacs::client::sync_manager::impl::perform_sync().

|
nodiscard |
Update an existing sync configuration.
| config | The configuration to update (identified by config_id) |
Definition at line 831 of file sync_manager.cpp.
References config(), kcenon::pacs::client::sync_manager::impl::get_config_from_cache(), impl_, kcenon::pacs::client::sync_manager::impl::logger, kcenon::pacs::pacs_void_error(), and kcenon::pacs::client::sync_manager::impl::save_config().

|
nodiscard |
Wait for a sync operation to complete.
| job_id | The job ID returned from sync operations |
Definition at line 943 of file sync_manager.cpp.
References kcenon::pacs::client::sync_manager::impl::completion_promises, impl_, and kcenon::pacs::client::sync_manager::impl::promises_mutex.
|
private |
Definition at line 452 of file sync_manager.h.
Referenced by add_config(), compare(), config(), full_sync(), get_config(), get_conflicts(), get_conflicts(), get_last_result(), get_statistics(), get_statistics(), incremental_sync(), is_scheduler_running(), is_syncing(), list_configs(), remove_config(), resolve_all_conflicts(), resolve_conflict(), set_completion_callback(), set_conflict_callback(), set_progress_callback(), start_scheduler(), stop_scheduler(), sync_manager(), sync_manager(), sync_now(), update_config(), and wait_for_sync().