27#include <shared_mutex>
35class sync_config_repository;
36class sync_conflict_repository;
37class sync_history_repository;
47class remote_node_manager;
51 std::shared_ptr<storage::sync_config_repository>
configs;
52 std::shared_ptr<storage::sync_conflict_repository>
conflicts;
53 std::shared_ptr<storage::sync_history_repository>
history;
120 std::shared_ptr<remote_node_manager> node_manager,
122 std::shared_ptr<services::query_scu>
query_scu,
123 std::shared_ptr<di::ILogger> logger =
nullptr);
140 std::shared_ptr<remote_node_manager> node_manager,
142 std::shared_ptr<services::query_scu>
query_scu,
143 std::shared_ptr<di::ILogger> logger =
nullptr);
157 std::shared_ptr<storage::sync_repository> repo,
158 std::shared_ptr<remote_node_manager> node_manager,
160 std::shared_ptr<services::query_scu>
query_scu,
161 std::shared_ptr<di::ILogger> logger =
nullptr);
177 std::shared_ptr<storage::sync_repository> repo,
178 std::shared_ptr<remote_node_manager> node_manager,
180 std::shared_ptr<services::query_scu>
query_scu,
181 std::shared_ptr<di::ILogger> logger =
nullptr);
220 [[nodiscard]]
auto remove_config(std::string_view config_id) -> kcenon::pacs::VoidResult;
228 [[nodiscard]]
auto get_config(std::string_view config_id)
const
229 -> std::optional<sync_config>;
250 [[nodiscard]] auto
sync_now(std::string_view config_id) -> std::
string;
260 [[nodiscard]] auto
full_sync(std::string_view config_id) -> std::
string;
270 [[nodiscard]] auto
incremental_sync(std::string_view config_id) -> std::
string;
321 [[nodiscard]] auto
get_conflicts(std::string_view config_id) const
332 std::string_view study_uid,
343 std::string_view config_id,
379 [[nodiscard]] auto
is_syncing(std::string_view config_id) const ->
bool;
407 [[nodiscard]] auto
get_statistics(std::string_view config_id) const
auto get_conflicts() const -> std::vector< sync_conflict >
Get all unresolved conflicts.
void start_scheduler()
Start the sync scheduler.
sync_manager(const sync_manager &)=delete
auto get_last_result(std::string_view config_id) const -> sync_result
Get the last sync result for a configuration.
auto sync_now(std::string_view config_id) -> std::string
Start sync immediately for a configuration.
auto compare_async(std::string_view config_id) -> std::future< sync_result >
Compare local and remote data asynchronously.
auto is_scheduler_running() const noexcept -> bool
Check if scheduler is running.
auto config() const noexcept -> const sync_manager_config &
Get current manager configuration.
auto add_config(const sync_config &config) -> kcenon::pacs::VoidResult
Add a new sync configuration.
auto resolve_conflict(std::string_view study_uid, conflict_resolution resolution) -> kcenon::pacs::VoidResult
Resolve a specific conflict.
auto compare(std::string_view config_id) -> sync_result
Compare local and remote data without syncing.
auto full_sync(std::string_view config_id) -> std::string
Perform a full sync for a configuration.
std::unique_ptr< impl > impl_
auto resolve_all_conflicts(std::string_view config_id, conflict_resolution resolution) -> kcenon::pacs::VoidResult
Resolve all conflicts for a configuration.
auto incremental_sync(std::string_view config_id) -> std::string
Perform an incremental sync for a configuration.
void set_conflict_callback(sync_conflict_callback callback)
Set callback for conflict detection.
auto operator=(const sync_manager &) -> sync_manager &=delete
void set_completion_callback(sync_completion_callback callback)
Set callback for sync completion.
auto remove_config(std::string_view config_id) -> kcenon::pacs::VoidResult
Remove a sync configuration.
void stop_scheduler()
Stop the sync scheduler.
auto is_syncing(std::string_view config_id) const -> bool
Check if a sync is currently running for a configuration.
auto update_config(const sync_config &config) -> kcenon::pacs::VoidResult
Update an existing sync configuration.
auto wait_for_sync(std::string_view job_id) -> std::future< sync_result >
Wait for a sync operation to complete.
auto operator=(sync_manager &&) -> sync_manager &=delete
void set_progress_callback(sync_progress_callback callback)
Set callback for sync progress updates.
~sync_manager()
Destructor - stops scheduler if running.
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(sync_manager &&)=delete
auto list_configs() const -> std::vector< sync_config >
List all sync configurations.
auto get_statistics() const -> sync_statistics
Get overall sync statistics.
auto get_config(std::string_view config_id) const -> std::optional< sync_config >
Get a sync configuration by ID.
Logger interface for dependency injection.
conflict_resolution
Strategy for resolving synchronization conflicts.
std::function< void( const std::string &config_id, size_t studies_synced, size_t studies_total)> sync_progress_callback
Callback for sync progress updates.
std::function< void(const sync_conflict &conflict)> sync_conflict_callback
Callback for conflict detection.
std::function< void( const std::string &config_id, const sync_result &result)> sync_completion_callback
Callback for sync completion.
Result<T> type aliases and helpers for PACS system.
Configuration for a synchronization task.
Represents a conflict detected during synchronization.
Configuration for the sync manager.
std::shared_ptr< storage::sync_conflict_repository > conflicts
std::shared_ptr< storage::sync_history_repository > history
std::shared_ptr< storage::sync_config_repository > configs
Result of a synchronization operation.
Aggregate statistics for synchronization operations.
Types and structures for bidirectional DICOM synchronization.