Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerIndex.h @ 4555:456ed3fcff81 db-changes
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 Mar 2021 17:13:41 +0100 |
parents | efd90f778cd2 |
children | 2f4d7ec9b993 |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1286
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4205
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
136 | 11 * |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
0 | 23 * |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
4045 | 36 #include "../../OrthancFramework/Sources/Cache/LeastRecentlyUsedIndex.h" |
37 #include "../../OrthancFramework/Sources/DicomFormat/DicomMap.h" | |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
38 |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
39 #include "Database/IDatabaseWrapper.h" |
4506
ac69c9f76c71
refactoring ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4505
diff
changeset
|
40 #include "DicomInstanceOrigin.h" |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
41 |
0 | 42 #include <boost/thread.hpp> |
220 | 43 #include <boost/noncopyable.hpp> |
186
f68c039b0571
preparing refactoring of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
183
diff
changeset
|
44 |
62 | 45 namespace Orthanc |
0 | 46 { |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
47 class DatabaseLookup; |
2209
e3fd5bc429a2
URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2188
diff
changeset
|
48 class ParsedDicomFile; |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
49 class ServerContext; |
226
8a26a8e85edf
refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
224
diff
changeset
|
50 |
220 | 51 class ServerIndex : public boost::noncopyable |
0 | 52 { |
1002
b067017a8a5b
anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
53 public: |
b067017a8a5b
anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
54 typedef std::list<FileInfo> Attachments; |
2894
a27b0e9a3fd9
refactoring DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2825
diff
changeset
|
55 typedef std::map<std::pair<ResourceType, MetadataType>, std::string> MetadataMap; |
1002
b067017a8a5b
anonymization refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
739
diff
changeset
|
56 |
0 | 57 private: |
1432
0ac74fa21db8
rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1364
diff
changeset
|
58 class Listener; |
278
771f12042be9
more efficient determination of storage size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
59 class Transaction; |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
60 class UnstableResourcePayload; |
3027 | 61 class MainDicomTagsRegistry; |
278
771f12042be9
more efficient determination of storage size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
272
diff
changeset
|
62 |
511
3b735fdf320b
monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
63 bool done_; |
0 | 64 boost::mutex mutex_; |
206
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
204
diff
changeset
|
65 boost::thread flushThread_; |
511
3b735fdf320b
monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
66 boost::thread unstableResourcesMonitorThread_; |
0 | 67 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
68 std::unique_ptr<Listener> listener_; |
1247 | 69 IDatabaseWrapper& db_; |
511
3b735fdf320b
monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
70 LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload> unstableResources_; |
180
626777d01dc4
use of hashes to index dicom objects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
179
diff
changeset
|
71 |
2825
8aa6aef11b70
New configuration option "OverwriteInstances" to choose how duplicate SOPInstanceUID are handled
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2668
diff
changeset
|
72 uint64_t maximumStorageSize_; |
269
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
73 unsigned int maximumPatients_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
74 std::unique_ptr<MainDicomTagsRegistry> mainDicomTagsRegistry_; |
269
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
75 |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
76 static void FlushThread(ServerIndex* that, |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
77 unsigned int threadSleep); |
511
3b735fdf320b
monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
78 |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
79 static void UnstableResourcesMonitorThread(ServerIndex* that, |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
80 unsigned int threadSleep); |
511
3b735fdf320b
monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
81 |
4554 | 82 // A transaction must be running |
83 static void MainDicomTagsToJson(Json::Value& result, | |
84 IDatabaseWrapper& db, | |
85 int64_t resourceId, | |
86 ResourceType resourceType); | |
198
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
87 |
268
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
88 bool IsRecyclingNeeded(uint64_t instanceSize); |
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
89 |
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
90 void Recycle(uint64_t instanceSize, |
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
91 const std::string& newPatientId); |
4bc02e2254ec
preparing ServerIndex for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
238
diff
changeset
|
92 |
269
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
93 void StandaloneRecycling(); |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
94 |
511
3b735fdf320b
monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
95 void MarkAsUnstable(int64_t id, |
1177
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
96 Orthanc::ResourceType type, |
5b2d8c280ac2
Plugins can monitor changes through callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
97 const std::string& publicId); |
511
3b735fdf320b
monitoring of stable patients/studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
98 |
1237 | 99 void LogChange(int64_t internalId, |
100 ChangeType changeType, | |
101 ResourceType resourceType, | |
1297 | 102 const std::string& publicId); |
1237 | 103 |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
104 void SignalNewResource(ChangeType changeType, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
105 ResourceType level, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
106 const std::string& publicId, |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
107 int64_t internalId); |
1237 | 108 |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3061
diff
changeset
|
109 uint64_t IncrementGlobalSequenceInternal(GlobalProperty property); |
1299 | 110 |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3027
diff
changeset
|
111 void NormalizeLookup(std::vector<DatabaseConstraint>& target, |
3027 | 112 const DatabaseLookup& source, |
113 ResourceType level) const; | |
114 | |
4554 | 115 // A transaction must be running |
116 static SeriesStatus GetSeriesStatus(IDatabaseWrapper& db, | |
117 int64_t id, | |
118 int64_t expectedNumberOfInstances); | |
119 | |
120 bool IsUnstableResource(int64_t id); | |
3090
31244604f617
starting optimization of SeriesIndex::GetSeriesStatus()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3086
diff
changeset
|
121 |
0 | 122 public: |
226
8a26a8e85edf
refactoring to read files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
224
diff
changeset
|
123 ServerIndex(ServerContext& context, |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
124 IDatabaseWrapper& database, |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
125 unsigned int threadSleep); |
0 | 126 |
206
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
204
diff
changeset
|
127 ~ServerIndex(); |
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
204
diff
changeset
|
128 |
1453
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
129 void Stop(); |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
130 |
269
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
131 uint64_t GetMaximumStorageSize() const |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
132 { |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
133 return maximumStorageSize_; |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
134 } |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
135 |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
136 uint64_t GetMaximumPatientCount() const |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
137 { |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
138 return maximumPatients_; |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
139 } |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
140 |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
141 // "size == 0" means no limit on the storage size |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
142 void SetMaximumStorageSize(uint64_t size); |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
143 |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
144 // "count == 0" means no limit on the number of patients |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
145 void SetMaximumPatientCount(unsigned int count); |
f6fdf5abe751
recycling up and running
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
268
diff
changeset
|
146 |
1006
649d47854314
proper handling of metadata in Store
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1004
diff
changeset
|
147 StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata, |
4505
97d103b57cd1
removed cached dicom summary from DicomInstanceToStore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4499
diff
changeset
|
148 const DicomMap& dicomSummary, |
3813
aaaa442bfe39
moving SetOverwriteInstances from ServerIndex to ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
149 const Attachments& attachments, |
4506
ac69c9f76c71
refactoring ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4505
diff
changeset
|
150 const MetadataMap& metadata, |
ac69c9f76c71
refactoring ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4505
diff
changeset
|
151 const DicomInstanceOrigin& origin, |
4499 | 152 bool overwrite, |
4506
ac69c9f76c71
refactoring ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4505
diff
changeset
|
153 bool hasTransferSyntax, |
4507
b4c58795f3a8
widening the use of DicomTransferSyntax enum
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4506
diff
changeset
|
154 DicomTransferSyntax transferSyntax, |
4499 | 155 bool hasPixelDataOffset, |
156 uint64_t pixelDataOffset); | |
0 | 157 |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
158 void GetGlobalStatistics(/* out */ uint64_t& diskSize, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
159 /* out */ uint64_t& uncompressedSize, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
160 /* out */ uint64_t& countPatients, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
161 /* out */ uint64_t& countStudies, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
162 /* out */ uint64_t& countSeries, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
163 /* out */ uint64_t& countInstances); |
0 | 164 |
1145
0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1139
diff
changeset
|
165 bool DeleteResource(Json::Value& target /* out */, |
212 | 166 const std::string& uuid, |
167 ResourceType expectedType); | |
0 | 168 |
1247 | 169 void GetChanges(Json::Value& target, |
0 | 170 int64_t since, |
171 unsigned int maxResults); | |
231 | 172 |
1247 | 173 void GetLastChange(Json::Value& target); |
237
16a4ac70bd8a
last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
233
diff
changeset
|
174 |
231 | 175 void LogExportedResource(const std::string& publicId, |
176 const std::string& remoteModality); | |
177 | |
1247 | 178 void GetExportedResources(Json::Value& target, |
231 | 179 int64_t since, |
180 unsigned int maxResults); | |
237
16a4ac70bd8a
last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
233
diff
changeset
|
181 |
1247 | 182 void GetLastExportedResource(Json::Value& target); |
237
16a4ac70bd8a
last change and export
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
233
diff
changeset
|
183 |
272
337c506461d2
protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
269
diff
changeset
|
184 bool IsProtectedPatient(const std::string& publicId); |
337c506461d2
protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
269
diff
changeset
|
185 |
337c506461d2
protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
269
diff
changeset
|
186 void SetProtectedPatient(const std::string& publicId, |
337c506461d2
protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
269
diff
changeset
|
187 bool isProtected); |
304 | 188 |
714
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
702
diff
changeset
|
189 void GetChildren(std::list<std::string>& result, |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
702
diff
changeset
|
190 const std::string& publicId); |
6a1dbba0cca7
new implementation of C-Find handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
702
diff
changeset
|
191 |
304 | 192 void GetChildInstances(std::list<std::string>& result, |
193 const std::string& publicId); | |
194 | |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
195 void SetMetadata(const std::string& publicId, |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
196 MetadataType type, |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
197 const std::string& value); |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
198 |
438 | 199 void DeleteMetadata(const std::string& publicId, |
200 MetadataType type); | |
201 | |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
202 bool LookupMetadata(std::string& target, |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
203 const std::string& publicId, |
4460
6831de40acd9
New metadata automatically computed at the series level: "RemoteAET"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
204 ResourceType expectedType, |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
205 MetadataType type); |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
206 |
4514
5b929e6b3c36
removal of "dicom-as-json" attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4507
diff
changeset
|
207 void ListAvailableAttachments(std::set<FileContentType>& target, |
697
dd1ce9a2844c
access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
208 const std::string& publicId, |
dd1ce9a2844c
access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
209 ResourceType expectedType); |
dd1ce9a2844c
access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
210 |
306
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
211 bool LookupParent(std::string& target, |
326d5a4a5af3
modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
304
diff
changeset
|
212 const std::string& publicId); |
310 | 213 |
214 uint64_t IncrementGlobalSequence(GlobalProperty sequence); | |
315 | 215 |
216 void LogChange(ChangeType changeType, | |
217 const std::string& publicId); | |
413
47d63c941902
clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
218 |
47d63c941902
clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
219 void DeleteChanges(); |
47d63c941902
clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
220 |
47d63c941902
clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
221 void DeleteExportedResources(); |
440
23e5b35e3c5c
statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
438
diff
changeset
|
222 |
3174
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
223 void GetResourceStatistics(/* out */ ResourceType& type, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
224 /* out */ uint64_t& diskSize, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
225 /* out */ uint64_t& uncompressedSize, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
226 /* out */ unsigned int& countStudies, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
227 /* out */ unsigned int& countSeries, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
228 /* out */ unsigned int& countInstances, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
229 /* out */ uint64_t& dicomDiskSize, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
230 /* out */ uint64_t& dicomUncompressedSize, |
8ea7c4546c3a
primitives to collect metrics in Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
231 const std::string& publicId); |
646 | 232 |
3034
54e422fe31ce
moving LookupResource to graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3031
diff
changeset
|
233 void LookupIdentifierExact(std::vector<std::string>& result, |
1728
4941494b5dd8
rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1727
diff
changeset
|
234 ResourceType level, |
4941494b5dd8
rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1727
diff
changeset
|
235 const DicomTag& tag, |
4941494b5dd8
rename LookupIdentifier as LookupIdentifierExact
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1727
diff
changeset
|
236 const std::string& value); |
615 | 237 |
699
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
238 StoreStatus AddAttachment(const FileInfo& attachment, |
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
239 const std::string& publicId); |
2929e17f8447
add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
697
diff
changeset
|
240 |
702
7592a48e97e4
delete custom attachment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
699
diff
changeset
|
241 void DeleteAttachment(const std::string& publicId, |
7592a48e97e4
delete custom attachment
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
699
diff
changeset
|
242 FileContentType type); |
1218
efece308018e
report database version in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1177
diff
changeset
|
243 |
1249
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1247
diff
changeset
|
244 void SetGlobalProperty(GlobalProperty property, |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1247
diff
changeset
|
245 const std::string& value); |
40725595aaf0
Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1247
diff
changeset
|
246 |
2668
d26dd081df97
saving jobs engine on exit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
247 bool LookupGlobalProperty(std::string& value, |
d26dd081df97
saving jobs engine on exit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
248 GlobalProperty property); |
d26dd081df97
saving jobs engine on exit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
249 |
1218
efece308018e
report database version in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1177
diff
changeset
|
250 std::string GetGlobalProperty(GlobalProperty property, |
efece308018e
report database version in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1177
diff
changeset
|
251 const std::string& defaultValue); |
1352 | 252 |
253 bool GetMainDicomTags(DicomMap& result, | |
254 const std::string& publicId, | |
1677
a903d57d9f0c
adaptation of search with patient tags at study level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
255 ResourceType expectedType, |
a903d57d9f0c
adaptation of search with patient tags at study level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
256 ResourceType levelOfInterest); |
1555
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
257 |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2987
diff
changeset
|
258 // Only applicable at the instance level |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2987
diff
changeset
|
259 bool GetAllMainDicomTags(DicomMap& result, |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2987
diff
changeset
|
260 const std::string& instancePublicId); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2987
diff
changeset
|
261 |
1555
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
262 bool LookupResourceType(ResourceType& type, |
d6a93e12b1c1
Creation of DICOM files with encapsulated PDF
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
263 const std::string& publicId); |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
264 |
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1555
diff
changeset
|
265 unsigned int GetDatabaseVersion(); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1728
diff
changeset
|
266 |
1898
e018037d4d0e
Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
267 bool LookupParent(std::string& target, |
e018037d4d0e
Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
268 const std::string& publicId, |
e018037d4d0e
Support of optional tags for counting resources in C-Find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
269 ResourceType parentType); |
2209
e3fd5bc429a2
URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2188
diff
changeset
|
270 |
4205 | 271 void ReconstructInstance(const ParsedDicomFile& dicom); |
3025
039a9d262d64
preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3020
diff
changeset
|
272 |
039a9d262d64
preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3020
diff
changeset
|
273 void ApplyLookupResources(std::vector<std::string>& resourcesId, |
3036
8fd203510d8b
moving LookupIdentifierQuery to the graveyard
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3034
diff
changeset
|
274 std::vector<std::string>* instancesId, // Can be NULL if not needed |
3025
039a9d262d64
preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3020
diff
changeset
|
275 const DatabaseLookup& lookup, |
039a9d262d64
preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3020
diff
changeset
|
276 ResourceType queryLevel, |
039a9d262d64
preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3020
diff
changeset
|
277 size_t limit); |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
278 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
279 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
280 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
281 /*** |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
282 ** PROTOTYPING FOR DB REFACTORING BELOW |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
283 ***/ |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
284 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
285 public: |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
286 class ReadOnlyTransaction : public boost::noncopyable |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
287 { |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
288 protected: |
4554 | 289 IDatabaseWrapper& db_; |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
290 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
291 public: |
4555 | 292 explicit ReadOnlyTransaction(IDatabaseWrapper& db) : |
4554 | 293 db_(db) |
294 { | |
295 } | |
296 | |
297 /** | |
298 * Higher-level constructions | |
299 **/ | |
300 | |
301 SeriesStatus GetSeriesStatus(int64_t id, | |
302 int64_t expectedNumberOfInstances) | |
303 { | |
304 return ServerIndex::GetSeriesStatus(db_, id, expectedNumberOfInstances); | |
305 } | |
306 | |
307 void MainDicomTagsToJson(Json::Value& result, | |
308 int64_t resourceId, | |
309 ResourceType resourceType) | |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
310 { |
4554 | 311 ServerIndex::MainDicomTagsToJson(result, db_, resourceId, resourceType); |
312 } | |
313 | |
314 /** | |
315 * Read-only methods from "IDatabaseWrapper" | |
316 **/ | |
317 | |
318 void GetAllMetadata(std::map<MetadataType, std::string>& target, | |
319 int64_t id) | |
320 { | |
321 db_.GetAllMetadata(target, id); | |
4555 | 322 } |
323 | |
324 void GetAllPublicIds(std::list<std::string>& target, | |
325 ResourceType resourceType) | |
326 { | |
327 return db_.GetAllPublicIds(target, resourceType); | |
328 } | |
329 | |
330 void GetAllPublicIds(std::list<std::string>& target, | |
331 ResourceType resourceType, | |
332 size_t since, | |
333 size_t limit) | |
334 { | |
335 return db_.GetAllPublicIds(target, resourceType, since, limit); | |
336 } | |
4554 | 337 |
338 void GetChildrenPublicId(std::list<std::string>& target, | |
339 int64_t id) | |
340 { | |
341 db_.GetChildrenPublicId(target, id); | |
342 } | |
343 | |
344 void GetMainDicomTags(DicomMap& map, | |
345 int64_t id) | |
346 { | |
347 db_.GetMainDicomTags(map, id); | |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
348 } |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
349 |
4554 | 350 bool LookupAttachment(FileInfo& attachment, |
351 int64_t id, | |
352 FileContentType contentType) | |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
353 { |
4554 | 354 return db_.LookupAttachment(attachment, id, contentType); |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
355 } |
4554 | 356 |
357 bool LookupResource(int64_t& id, | |
358 ResourceType& type, | |
359 const std::string& publicId) | |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
360 { |
4554 | 361 return db_.LookupResource(id, type, publicId); |
362 } | |
363 | |
364 bool LookupResourceAndParent(int64_t& id, | |
365 ResourceType& type, | |
366 std::string& parentPublicId, | |
367 const std::string& publicId) | |
368 { | |
369 return db_.LookupResourceAndParent(id, type, parentPublicId, publicId); | |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
370 } |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
371 }; |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
372 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
373 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
374 class ReadWriteTransaction : public ReadOnlyTransaction |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
375 { |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
376 public: |
4555 | 377 explicit ReadWriteTransaction(IDatabaseWrapper& db) : |
4554 | 378 ReadOnlyTransaction(db) |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
379 { |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
380 } |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
381 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
382 }; |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
383 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
384 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
385 class IReadOnlyOperations : public boost::noncopyable |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
386 { |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
387 public: |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
388 virtual ~IReadOnlyOperations() |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
389 { |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
390 } |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
391 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
392 virtual void Apply(ReadOnlyTransaction& transaction) = 0; |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
393 }; |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
394 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
395 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
396 class IReadWriteOperations : public boost::noncopyable |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
397 { |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
398 public: |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
399 virtual ~IReadWriteOperations() |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
400 { |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
401 } |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
402 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
403 virtual void Apply(ReadWriteTransaction& transaction) = 0; |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
404 }; |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
405 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
406 |
4555 | 407 typedef void (*ReadOnlyFunction) (ReadOnlyTransaction& transaction); // TODO - Is this useful? |
408 typedef void (*ReadWriteFunction) (ReadWriteTransaction& transaction); // TODO - Is this useful? | |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
409 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
410 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
411 private: |
4555 | 412 class ReadOnlyWrapper; // TODO - Is this useful? |
413 class ReadWriteWrapper; // TODO - Is this useful? | |
4551
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
414 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
415 void ApplyInternal(IReadOnlyOperations* readOperations, |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
416 IReadWriteOperations* writeOperations); |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
417 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
418 unsigned int maxRetries_; |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
419 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
420 public: |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
421 void Apply(IReadOnlyOperations& operations); |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
422 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
423 void Apply(IReadWriteOperations& operations); |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
424 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
425 void Apply(ReadOnlyFunction func); |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
426 |
350a22c094f2
testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4514
diff
changeset
|
427 void Apply(ReadWriteFunction func); |
4554 | 428 |
429 bool ExpandResource(Json::Value& target, | |
430 const std::string& publicId, | |
431 ResourceType level); | |
432 | |
433 void GetAllMetadata(std::map<MetadataType, std::string>& target, | |
434 const std::string& publicId, | |
435 ResourceType level); | |
4555 | 436 |
437 void GetAllUuids(std::list<std::string>& target, | |
438 ResourceType resourceType); | |
439 | |
440 void GetAllUuids(std::list<std::string>& target, | |
441 ResourceType resourceType, | |
442 size_t since, | |
443 size_t limit); | |
444 | |
445 bool LookupAttachment(FileInfo& attachment, | |
446 const std::string& instancePublicId, | |
447 FileContentType contentType); | |
0 | 448 }; |
449 } |