PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
sync_conflict_repository.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
14#pragma once
15
18
19#ifdef PACS_WITH_DATABASE_SYSTEM
20
21namespace kcenon::pacs::storage {
22
26class sync_conflict_repository
27 : public base_repository<client::sync_conflict, std::string> {
28public:
29 explicit sync_conflict_repository(
30 std::shared_ptr<pacs_database_adapter> db);
31
32 [[nodiscard]] auto find_by_study_uid(std::string_view study_uid)
33 -> result_type;
34
35 [[nodiscard]] auto find_by_config(std::string_view config_id)
36 -> list_result_type;
37
38 [[nodiscard]] auto find_unresolved() -> list_result_type;
39
40 [[nodiscard]] auto resolve(
41 std::string_view study_uid,
42 client::conflict_resolution resolution) -> VoidResult;
43
44 [[nodiscard]] auto cleanup_old(std::chrono::hours max_age)
45 -> Result<size_t>;
46
47protected:
48 [[nodiscard]] auto map_row_to_entity(const database_row& row) const
49 -> client::sync_conflict override;
50
51 [[nodiscard]] auto entity_to_row(const client::sync_conflict& entity) const
52 -> std::map<std::string, database_value> override;
53
54 [[nodiscard]] auto get_pk(const client::sync_conflict& entity) const
55 -> std::string override;
56
57 [[nodiscard]] auto has_pk(const client::sync_conflict& entity) const
58 -> bool override;
59
60 [[nodiscard]] auto select_columns() const
61 -> std::vector<std::string> override;
62
63private:
64 [[nodiscard]] auto parse_timestamp(const std::string& str) const
65 -> std::chrono::system_clock::time_point;
66
67 [[nodiscard]] auto format_timestamp(
68 std::chrono::system_clock::time_point tp) const -> std::string;
69};
70
71} // namespace kcenon::pacs::storage
72
73#endif // PACS_WITH_DATABASE_SYSTEM
Generic base repository for CRUD operations.
Types and structures for bidirectional DICOM synchronization.