libquentier 0.8.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
ISyncConflictResolver.h
1/*
2 * Copyright 2021-2024 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <quentier/utility/Linkage.h>
22
23#include <qevercloud/types/Note.h>
24#include <qevercloud/types/Notebook.h>
25#include <qevercloud/types/SavedSearch.h>
26#include <qevercloud/types/Tag.h>
27
28#include <QFuture>
29
30#include <variant>
31
32class QDebug;
33class QTextStream;
34
35namespace quentier::synchronization {
36
42{
43public:
49 {
56
62 {};
63
71
80 template <class T>
81 struct MoveMine
82 {
83 using value_type = T;
84
89 };
90 };
91
92 using NotebookConflictResolution = std::variant<
96
97 using NoteConflictResolution = std::variant<
101
102 using SavedSearchConflictResolution = std::variant<
106
107 using TagConflictResolution = std::variant<
111
112public:
114
115 [[nodiscard]] virtual QFuture<NotebookConflictResolution>
116 resolveNotebookConflict(
117 qevercloud::Notebook theirs, qevercloud::Notebook mine) = 0;
118
119 [[nodiscard]] virtual QFuture<NoteConflictResolution> resolveNoteConflict(
120 qevercloud::Note theirs, qevercloud::Note mine) = 0;
121
122 [[nodiscard]] virtual QFuture<SavedSearchConflictResolution>
123 resolveSavedSearchConflict(
124 qevercloud::SavedSearch theirs, qevercloud::SavedSearch mine) = 0;
125
126 [[nodiscard]] virtual QFuture<TagConflictResolution> resolveTagConflict(
127 qevercloud::Tag theirs, qevercloud::Tag mine) = 0;
128};
129
132 const ISyncConflictResolver::NotebookConflictResolution & resolution);
133
135 QDebug & dbg,
136 const ISyncConflictResolver::NotebookConflictResolution & resolution);
137
140 const ISyncConflictResolver::NoteConflictResolution & resolution);
141
143 QDebug & dbg,
144 const ISyncConflictResolver::NoteConflictResolution & resolution);
145
148 const ISyncConflictResolver::SavedSearchConflictResolution & resolution);
149
151 QDebug & dbg,
152 const ISyncConflictResolver::SavedSearchConflictResolution & resolution);
153
156 const ISyncConflictResolver::TagConflictResolution & resolution);
157
159 QDebug & dbg,
160 const ISyncConflictResolver::TagConflictResolution & resolution);
161
162} // namespace quentier::synchronization
The Result template class represents the bare bones result monad implementation which either contains...
Definition Result.h:38
The ISyncConflictResolver interface provides methods used to resolve conflicts between local and remo...
Definition ISyncConflictResolver.h:42
The IgnoreMine conflict resolution means "use theirs version and ignore mine version as it doesn't re...
Definition ISyncConflictResolver.h:70
The MoveMine conflict resolution means "before using theirs version change mine version as specified"...
Definition ISyncConflictResolver.h:82
The UseMine conflict resolution means "override theirs version with mine version".
Definition ISyncConflictResolver.h:62
The UseTheirs conflict resolution means "override mine version with theirs version".
Definition ISyncConflictResolver.h:55
The ConflictResolution struct is a namespace inside which several other structs determining actual co...
Definition ISyncConflictResolver.h:49