annotate OrthancServer/Sources/ServerIndex.h @ 4563:bb1c365f9e44 db-changes

end of refactoring read-only transactions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Mar 2021 16:11:11 +0100
parents e19f11e08226
children 3495a3d97ab6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1898
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
11 *
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
12 * In addition, as a special exception, the copyright holders of this
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
13 * program give permission to link the code of its release with the
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
16 * the linked executables. You must obey the GNU General Public License
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
20 * you do not wish to do so, delete this exception statement from your
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
21 * version. If you delete this exception statement from all source files
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
22 * in the program, then also delete it here.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
36 #include "../../OrthancFramework/Sources/Cache/LeastRecentlyUsedIndex.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 #include <boost/thread.hpp>
220
bb8c260c0092 fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
43 #include <boost/noncopyable.hpp>
186
f68c039b0571 preparing refactoring of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 183
diff changeset
44
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
45 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
bb8c260c0092 fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
51 class ServerIndex : public boost::noncopyable
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1238
diff changeset
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
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
82 // A transaction must be running
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
83 static void MainDicomTagsToJson(Json::Value& result,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
84 IDatabaseWrapper& db,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
85 int64_t resourceId,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
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
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
99 void LogChange(int64_t internalId,
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
100 ChangeType changeType,
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
101 ResourceType resourceType,
1297
501432928727 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
102 const std::string& publicId);
1237
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
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
0f3716b88af7 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1218
diff changeset
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
4ce47e8ed0d2 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1297
diff changeset
110
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3027
diff changeset
111 void NormalizeLookup(std::vector<DatabaseConstraint>& target,
3027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
112 const DatabaseLookup& source,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
113 ResourceType level) const;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3025
diff changeset
114
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
115 // A transaction must be running
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
116 static SeriesStatus GetSeriesStatus(IDatabaseWrapper& db,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
117 int64_t id,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
118 int64_t expectedNumberOfInstances);
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
119
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
6f99949b2878 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4460
diff changeset
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
6f99949b2878 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4460
diff changeset
155 bool hasPixelDataOffset,
6f99949b2878 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4460
diff changeset
156 uint64_t pixelDataOffset);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
1145
0479d02c6778 Plugins can retrieve the path to Orthanc and to its configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1139
diff changeset
158 bool DeleteResource(Json::Value& target /* out */,
212
f276b175dcaf delete resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 206
diff changeset
159 const std::string& uuid,
f276b175dcaf delete resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 206
diff changeset
160 ResourceType expectedType);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
231
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
162 void LogExportedResource(const std::string& publicId,
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
163 const std::string& remoteModality);
8098448bd827 export log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
164
272
337c506461d2 protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 269
diff changeset
165 void SetProtectedPatient(const std::string& publicId,
337c506461d2 protection from rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 269
diff changeset
166 bool isProtected);
304
4eea080e6e7a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 278
diff changeset
167
306
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
168 void SetMetadata(const std::string& publicId,
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
169 MetadataType type,
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
170 const std::string& value);
326d5a4a5af3 modification of instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 304
diff changeset
171
438
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
172 void DeleteMetadata(const std::string& publicId,
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
173 MetadataType type);
7bbe77cb9e12 DELETE metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 436
diff changeset
174
310
6ab6cdeedf4e global sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 306
diff changeset
175 uint64_t IncrementGlobalSequence(GlobalProperty sequence);
315
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 310
diff changeset
176
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 310
diff changeset
177 void LogChange(ChangeType changeType,
fc856d175d18 modifications
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 310
diff changeset
178 const std::string& publicId);
413
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
179
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
180 void DeleteChanges();
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
181
47d63c941902 clearing /exports and /changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
182 void DeleteExportedResources();
440
23e5b35e3c5c statistics for patient/studies/series/instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 438
diff changeset
183
699
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
184 StoreStatus AddAttachment(const FileInfo& attachment,
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
185 const std::string& publicId);
2929e17f8447 add attachments to resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
186
702
7592a48e97e4 delete custom attachment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
187 void DeleteAttachment(const std::string& publicId,
7592a48e97e4 delete custom attachment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 699
diff changeset
188 FileContentType type);
1218
efece308018e report database version in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1177
diff changeset
189
1249
40725595aaf0 Plugins can get/set global properties to save their configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1247
diff changeset
190 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
191 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
192
4205
d962a2996637 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
193 void ReconstructInstance(const ParsedDicomFile& dicom);
3025
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3020
diff changeset
194
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
195
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
196
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
197 /***
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
198 ** PROTOTYPING FOR DB REFACTORING BELOW
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
199 ***/
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
200
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
201 public:
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
202 class ReadOnlyTransaction : public boost::noncopyable
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
203 {
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
204 protected:
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
205 IDatabaseWrapper& db_;
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
206
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
207 public:
4555
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
208 explicit ReadOnlyTransaction(IDatabaseWrapper& db) :
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
209 db_(db)
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
210 {
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
211 }
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
212
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
213 /**
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
214 * Higher-level constructions
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
215 **/
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
216
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
217 SeriesStatus GetSeriesStatus(int64_t id,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
218 int64_t expectedNumberOfInstances)
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
219 {
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
220 return ServerIndex::GetSeriesStatus(db_, id, expectedNumberOfInstances);
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
221 }
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
222
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
223 void MainDicomTagsToJson(Json::Value& result,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
224 int64_t resourceId,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
225 ResourceType resourceType)
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
226 {
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
227 ServerIndex::MainDicomTagsToJson(result, db_, resourceId, resourceType);
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
228 }
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
229
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
230 /**
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
231 * Read-only methods from "IDatabaseWrapper"
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
232 **/
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
233
4562
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
234 void ApplyLookupResources(std::list<std::string>& resourcesId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
235 std::list<std::string>* instancesId, // Can be NULL if not needed
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
236 const std::vector<DatabaseConstraint>& lookup,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
237 ResourceType queryLevel,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
238 size_t limit)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
239 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
240 return db_.ApplyLookupResources(resourcesId, instancesId, lookup, queryLevel, limit);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
241 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
242
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
243 void GetAllMetadata(std::map<MetadataType, std::string>& target,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
244 int64_t id)
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
245 {
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
246 db_.GetAllMetadata(target, id);
4555
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
247 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
248
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
249 void GetAllPublicIds(std::list<std::string>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
250 ResourceType resourceType)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
251 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
252 return db_.GetAllPublicIds(target, resourceType);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
253 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
254
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
255 void GetAllPublicIds(std::list<std::string>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
256 ResourceType resourceType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
257 size_t since,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
258 size_t limit)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
259 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
260 return db_.GetAllPublicIds(target, resourceType, since, limit);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
261 }
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
262
4558
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
263 void GetChanges(std::list<ServerIndexChange>& target /*out*/,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
264 bool& done /*out*/,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
265 int64_t since,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
266 uint32_t maxResults)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
267 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
268 db_.GetChanges(target, done, since, maxResults);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
269 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
270
4559
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
271 void GetChildrenInternalId(std::list<int64_t>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
272 int64_t id)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
273 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
274 db_.GetChildrenInternalId(target, id);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
275 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
276
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
277 void GetChildrenPublicId(std::list<std::string>& target,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
278 int64_t id)
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
279 {
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
280 db_.GetChildrenPublicId(target, id);
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
281 }
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
282
4563
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
283 unsigned int GetDatabaseVersion()
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
284 {
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
285 return db_.GetDatabaseVersion();
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
286 }
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
287
4558
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
288 void GetExportedResources(std::list<ExportedResource>& target /*out*/,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
289 bool& done /*out*/,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
290 int64_t since,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
291 uint32_t maxResults)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
292 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
293 return db_.GetExportedResources(target, done, since, maxResults);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
294 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
295
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
296 void GetLastChange(std::list<ServerIndexChange>& target /*out*/)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
297 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
298 db_.GetLastChange(target);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
299 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
300
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
301 void GetLastExportedResource(std::list<ExportedResource>& target /*out*/)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
302 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
303 return db_.GetLastExportedResource(target);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
304 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
305
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
306 int64_t GetLastChangeIndex()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
307 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
308 return db_.GetLastChangeIndex();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
309 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
310
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
311 void GetMainDicomTags(DicomMap& map,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
312 int64_t id)
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
313 {
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
314 db_.GetMainDicomTags(map, id);
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
315 }
4558
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
316
4559
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
317 std::string GetPublicId(int64_t resourceId)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
318 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
319 return db_.GetPublicId(resourceId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
320 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
321
4558
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
322 uint64_t GetResourceCount(ResourceType resourceType)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
323 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
324 return db_.GetResourceCount(resourceType);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
325 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
326
4559
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
327 ResourceType GetResourceType(int64_t resourceId)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
328 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
329 return db_.GetResourceType(resourceId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
330 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
331
4558
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
332 uint64_t GetTotalCompressedSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
333 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
334 return db_.GetTotalCompressedSize();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
335 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
336
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
337 uint64_t GetTotalUncompressedSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
338 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
339 return db_.GetTotalUncompressedSize();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
340 }
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
341
4559
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
342 bool IsProtectedPatient(int64_t internalId)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
343 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
344 return db_.IsProtectedPatient(internalId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
345 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
346
4560
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
347 void ListAvailableAttachments(std::set<FileContentType>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
348 int64_t id)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
349 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
350 db_.ListAvailableAttachments(target, id);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
351 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
352
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
353 bool LookupAttachment(FileInfo& attachment,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
354 int64_t id,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
355 FileContentType contentType)
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
356 {
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
357 return db_.LookupAttachment(attachment, id, contentType);
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
358 }
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
359
4562
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
360 bool LookupGlobalProperty(std::string& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
361 GlobalProperty property)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
362 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
363 return db_.LookupGlobalProperty(target, property);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
364 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
365
4560
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
366 bool LookupMetadata(std::string& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
367 int64_t id,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
368 MetadataType type)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
369 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
370 return db_.LookupMetadata(target, id, type);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
371 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
372
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
373 bool LookupParent(int64_t& parentId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
374 int64_t resourceId)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
375 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
376 return db_.LookupParent(parentId, resourceId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
377 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
378
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
379 bool LookupResource(int64_t& id,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
380 ResourceType& type,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
381 const std::string& publicId)
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
382 {
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
383 return db_.LookupResource(id, type, publicId);
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
384 }
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
385
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
386 bool LookupResourceAndParent(int64_t& id,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
387 ResourceType& type,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
388 std::string& parentPublicId,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
389 const std::string& publicId)
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
390 {
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
391 return db_.LookupResourceAndParent(id, type, parentPublicId, publicId);
4551
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
392 }
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 ReadWriteTransaction : public ReadOnlyTransaction
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:
4555
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
399 explicit ReadWriteTransaction(IDatabaseWrapper& db) :
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
400 ReadOnlyTransaction(db)
4551
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
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
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
407 class IReadOnlyOperations : public boost::noncopyable
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
408 {
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
409 public:
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
410 virtual ~IReadOnlyOperations()
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
411 {
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
412 }
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
413
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
414 virtual void Apply(ReadOnlyTransaction& transaction) = 0;
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
415 };
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
416
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 class IReadWriteOperations : public boost::noncopyable
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 virtual ~IReadWriteOperations()
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 }
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 virtual void Apply(ReadWriteTransaction& transaction) = 0;
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
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
428 private:
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
429 void ApplyInternal(IReadOnlyOperations* readOperations,
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
430 IReadWriteOperations* writeOperations);
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
431
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
432 unsigned int maxRetries_;
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
433
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
434 public:
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
435 void Apply(IReadOnlyOperations& operations);
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
436
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
437 void Apply(IReadWriteOperations& operations);
350a22c094f2 testing replay of transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4514
diff changeset
438
4554
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
439 bool ExpandResource(Json::Value& target,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
440 const std::string& publicId,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
441 ResourceType level);
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
442
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
443 void GetAllMetadata(std::map<MetadataType, std::string>& target,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
444 const std::string& publicId,
efd90f778cd2 simplification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4551
diff changeset
445 ResourceType level);
4555
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
446
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
447 void GetAllUuids(std::list<std::string>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
448 ResourceType resourceType);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
449
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
450 void GetAllUuids(std::list<std::string>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
451 ResourceType resourceType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
452 size_t since,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
453 size_t limit);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
454
4558
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
455 void GetGlobalStatistics(/* out */ uint64_t& diskSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
456 /* out */ uint64_t& uncompressedSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
457 /* out */ uint64_t& countPatients,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
458 /* out */ uint64_t& countStudies,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
459 /* out */ uint64_t& countSeries,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
460 /* out */ uint64_t& countInstances);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
461
4555
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
462 bool LookupAttachment(FileInfo& attachment,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
463 const std::string& instancePublicId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4554
diff changeset
464 FileContentType contentType);
4558
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
465
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
466 void GetChanges(Json::Value& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
467 int64_t since,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
468 unsigned int maxResults);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
469
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
470 void GetLastChange(Json::Value& target);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
471
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
472 void GetExportedResources(Json::Value& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
473 int64_t since,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
474 unsigned int maxResults);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
475
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
476 void GetLastExportedResource(Json::Value& target);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4555
diff changeset
477
4559
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
478 bool IsProtectedPatient(const std::string& publicId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
479
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
480 void GetChildren(std::list<std::string>& result,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
481 const std::string& publicId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
482
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
483 void GetChildInstances(std::list<std::string>& result,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4558
diff changeset
484 const std::string& publicId);
4560
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
485
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
486 bool LookupMetadata(std::string& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
487 const std::string& publicId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
488 ResourceType expectedType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
489 MetadataType type);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
490
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
491 void ListAvailableAttachments(std::set<FileContentType>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
492 const std::string& publicId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
493 ResourceType expectedType);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
494
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
495 bool LookupParent(std::string& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4559
diff changeset
496 const std::string& publicId);
4562
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
497
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
498 void GetResourceStatistics(/* out */ ResourceType& type,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
499 /* out */ uint64_t& diskSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
500 /* out */ uint64_t& uncompressedSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
501 /* out */ unsigned int& countStudies,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
502 /* out */ unsigned int& countSeries,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
503 /* out */ unsigned int& countInstances,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
504 /* out */ uint64_t& dicomDiskSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
505 /* out */ uint64_t& dicomUncompressedSize,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
506 const std::string& publicId);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
507
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
508 void LookupIdentifierExact(std::vector<std::string>& result,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
509 ResourceType level,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
510 const DicomTag& tag,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
511 const std::string& value);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
512
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
513 bool LookupGlobalProperty(std::string& value,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
514 GlobalProperty property);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
515
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
516 std::string GetGlobalProperty(GlobalProperty property,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
517 const std::string& defaultValue);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
518
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
519 bool GetMainDicomTags(DicomMap& result,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
520 const std::string& publicId,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
521 ResourceType expectedType,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4561
diff changeset
522 ResourceType levelOfInterest);
4563
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
523
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
524 // Only applicable at the instance level
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
525 bool GetAllMainDicomTags(DicomMap& result,
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
526 const std::string& instancePublicId);
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
527
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
528 bool LookupResourceType(ResourceType& type,
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
529 const std::string& publicId);
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
530
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
531 unsigned int GetDatabaseVersion();
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
532
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
533 bool LookupParent(std::string& target,
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
534 const std::string& publicId,
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
535 ResourceType parentType);
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
536
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
537 void ApplyLookupResources(std::vector<std::string>& resourcesId,
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
538 std::vector<std::string>* instancesId, // Can be NULL if not needed
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
539 const DatabaseLookup& lookup,
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
540 ResourceType queryLevel,
bb1c365f9e44 end of refactoring read-only transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4562
diff changeset
541 size_t limit);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 }