annotate OrthancServer/Sources/Database/StatelessDatabaseOperations.h @ 5656:a3c244090f67 find-refactoring

integration mainline->find-refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Jun 2024 13:24:04 +0200
parents 3f13db27b399
children dc96401dbe88
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5603
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5603
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5316
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * published by the Free Software Foundation, either version 3 of the
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * General Public License for more details.
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h"
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5605
diff changeset
28 #include "../DicomInstanceOrigin.h"
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include "IDatabaseWrapper.h"
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5605
diff changeset
30 #include "MainDicomTagsRegistry.h"
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
4594
d494b4f1103e removed the global database mutex from ServerIndex and StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4591
diff changeset
32 #include <boost/shared_ptr.hpp>
4613
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
33 #include <boost/thread/shared_mutex.hpp>
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 namespace Orthanc
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 class DatabaseLookup;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 class ParsedDicomFile;
4588
94147ce2f097 fix build on os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4587
diff changeset
40 struct ServerIndexChange;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
42 class ExpandedResource : public boost::noncopyable
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
43 {
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
44 private:
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
45 std::string id_;
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
46 ResourceType level_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
47 DicomMap tags_; // all main tags and main sequences from DB
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
48
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
49 public:
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
50 std::string mainDicomTagsSignature_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
51 std::string parentId_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
52 std::list<std::string> childrenIds_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
53 std::map<MetadataType, std::string> metadata_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
54 std::string anonymizedFrom_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
55 std::string modifiedFrom_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
56 std::string lastUpdate_;
4936
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
57 std::set<DicomTag> missingRequestedTags_;
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
58
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
59 // for patients/studies/series
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
60 bool isStable_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
61
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
62 // for series only
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
63 int expectedNumberOfInstances_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
64 std::string status_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
65
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
66 // for instances only
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
67 size_t fileSize_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
68 std::string fileUuid_;
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
69 int indexInSeries_;
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
70
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
71 // New in Orthanc 1.12.0
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
72 std::set<std::string> labels_;
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
73
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
74 public:
5277
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
75 // TODO - Cleanup
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
76 ExpandedResource() :
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
77 level_(ResourceType_Instance),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
78 isStable_(false),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
79 expectedNumberOfInstances_(0),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
80 fileSize_(0),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
81 indexInSeries_(0)
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
82 {
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
83 }
5568
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
84
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
85 void SetResource(ResourceType level,
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
86 const std::string& id)
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
87 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
88 level_ = level;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
89 id_ = id;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
90 }
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
91
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
92 const std::string& GetPublicId() const
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
93 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
94 return id_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
95 }
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
96
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
97 ResourceType GetLevel() const
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
98 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
99 return level_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
100 }
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
101
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
102 DicomMap& GetMainDicomTags()
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
103 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
104 return tags_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
105 }
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
106
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
107 const DicomMap& GetMainDicomTags() const
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
108 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
109 return tags_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
110 }
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
111 };
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
112
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
113 enum ExpandResourceFlags
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4939
diff changeset
114 {
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
115 ExpandResourceFlags_None = 0,
5568
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
116 // used to fetch from DB and for output
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
117 ExpandResourceFlags_IncludeMetadata = (1 << 0),
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
118 ExpandResourceFlags_IncludeChildren = (1 << 1),
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
119 ExpandResourceFlags_IncludeMainDicomTags = (1 << 2),
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
120 ExpandResourceFlags_IncludeLabels = (1 << 3),
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4939
diff changeset
121
5568
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
122 // only used for output
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
123 ExpandResourceFlags_IncludeAllMetadata = (1 << 4), // new in Orthanc 1.12.4
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
124 ExpandResourceFlags_IncludeIsStable = (1 << 5), // new in Orthanc 1.12.4
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
125
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
126 ExpandResourceFlags_DefaultExtract = (ExpandResourceFlags_IncludeMetadata |
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
127 ExpandResourceFlags_IncludeChildren |
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
128 ExpandResourceFlags_IncludeMainDicomTags |
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
129 ExpandResourceFlags_IncludeLabels),
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
130
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
131 ExpandResourceFlags_DefaultOutput = (ExpandResourceFlags_IncludeMetadata |
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
132 ExpandResourceFlags_IncludeChildren |
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
133 ExpandResourceFlags_IncludeMainDicomTags |
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
134 ExpandResourceFlags_IncludeLabels |
b0b5546f1b9f find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents: 5554
diff changeset
135 ExpandResourceFlags_IncludeIsStable)
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4939
diff changeset
136 };
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
137
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 class StatelessDatabaseOperations : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 typedef std::list<FileInfo> Attachments;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 typedef std::map<std::pair<ResourceType, MetadataType>, std::string> MetadataMap;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
144 enum LabelOperation
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
145 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
146 LabelOperation_Add,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
147 LabelOperation_Remove
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
148 };
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
149
4589
bec74e29f86b attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4588
diff changeset
150 class ITransactionContext : public IDatabaseListener
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 virtual ~ITransactionContext()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 virtual void Commit() = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 virtual int64_t GetCompressedSizeDelta() = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
5603
b2a97dfd719f monitoring of stable resources now also considers the resource type
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5558
diff changeset
161 virtual bool IsUnstableResource(Orthanc::ResourceType type,
b2a97dfd719f monitoring of stable resources now also considers the resource type
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5558
diff changeset
162 int64_t id) = 0;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 virtual bool LookupRemainingLevel(std::string& remainingPublicId /* out */,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 ResourceType& remainingLevel /* out */) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
5603
b2a97dfd719f monitoring of stable resources now also considers the resource type
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5558
diff changeset
167 virtual void MarkAsUnstable(Orthanc::ResourceType type,
b2a97dfd719f monitoring of stable resources now also considers the resource type
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5558
diff changeset
168 int64_t id,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 const std::string& publicId) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 virtual void SignalAttachmentsAdded(uint64_t compressedSize) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 virtual void SignalChange(const ServerIndexChange& change) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 class ITransactionContextFactory : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 virtual ~ITransactionContextFactory()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
4594
d494b4f1103e removed the global database mutex from ServerIndex and StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4591
diff changeset
184 // WARNING: This method can be invoked from several threads concurrently
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 virtual ITransactionContext* Create() = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 class ReadOnlyTransaction : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 private:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 ITransactionContext& context_;
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
193
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 protected:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
195 IDatabaseWrapper::ITransaction& transaction_;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 public:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
198 explicit ReadOnlyTransaction(IDatabaseWrapper::ITransaction& transaction,
5522
dd430a1b21fe simplifying StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5517
diff changeset
199 ITransactionContext& context) :
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 context_(context),
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
201 transaction_(transaction)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 ITransactionContext& GetTransactionContext()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 return context_;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 /**
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 * Higher-level constructions
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 **/
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 SeriesStatus GetSeriesStatus(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 int64_t expectedNumberOfInstances);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 /**
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 * Read-only methods from "IDatabaseWrapper"
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 **/
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 void ApplyLookupResources(std::list<std::string>& resourcesId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 std::list<std::string>* instancesId, // Can be NULL if not needed
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 const std::vector<DatabaseConstraint>& lookup,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 ResourceType queryLevel,
5248
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
226 const std::set<std::string>& labels, // New in Orthanc 1.12.0
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
227 LabelsConstraint labelsConstraint, // New in Orthanc 1.12.0
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
228 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 {
5248
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
230 return transaction_.ApplyLookupResources(resourcesId, instancesId, lookup, queryLevel,
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
231 labels, labelsConstraint, limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 void GetAllMetadata(std::map<MetadataType, std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
237 transaction_.GetAllMetadata(target, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 void GetAllPublicIds(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 ResourceType resourceType)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
243 return transaction_.GetAllPublicIds(target, resourceType);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 void GetAllPublicIds(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 ResourceType resourceType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 size_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
249 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
251 return transaction_.GetAllPublicIds(target, resourceType, since, limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 void GetChanges(std::list<ServerIndexChange>& target /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 bool& done /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
257 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 {
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
259 transaction_.GetChanges(target, done, since, limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 void GetChildrenInternalId(std::list<int64_t>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
265 transaction_.GetChildrenInternalId(target, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 void GetChildrenPublicId(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
271 transaction_.GetChildrenPublicId(target, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 void GetExportedResources(std::list<ExportedResource>& target /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 bool& done /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
277 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 {
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
279 return transaction_.GetExportedResources(target, done, since, limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 void GetLastChange(std::list<ServerIndexChange>& target /*out*/)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
284 transaction_.GetLastChange(target);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 void GetLastExportedResource(std::list<ExportedResource>& target /*out*/)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
289 return transaction_.GetLastExportedResource(target);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 int64_t GetLastChangeIndex()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
294 return transaction_.GetLastChangeIndex();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 void GetMainDicomTags(DicomMap& map,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
300 transaction_.GetMainDicomTags(map, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 std::string GetPublicId(int64_t resourceId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
305 return transaction_.GetPublicId(resourceId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4594
diff changeset
308 uint64_t GetResourcesCount(ResourceType resourceType)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 {
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4594
diff changeset
310 return transaction_.GetResourcesCount(resourceType);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 ResourceType GetResourceType(int64_t resourceId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
315 return transaction_.GetResourceType(resourceId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 uint64_t GetTotalCompressedSize()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
320 return transaction_.GetTotalCompressedSize();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 uint64_t GetTotalUncompressedSize()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
325 return transaction_.GetTotalUncompressedSize();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 bool IsProtectedPatient(int64_t internalId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
330 return transaction_.IsProtectedPatient(internalId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 void ListAvailableAttachments(std::set<FileContentType>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
336 transaction_.ListAvailableAttachments(target, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 bool LookupAttachment(FileInfo& attachment,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
340 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 FileContentType contentType)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 {
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
344 return transaction_.LookupAttachment(attachment, revision, id, contentType);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 bool LookupGlobalProperty(std::string& target,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
348 GlobalProperty property,
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
349 bool shared)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 {
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
351 return transaction_.LookupGlobalProperty(target, property, shared);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 bool LookupMetadata(std::string& target,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
355 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 MetadataType type)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 {
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
359 return transaction_.LookupMetadata(target, revision, id, type);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 bool LookupParent(int64_t& parentId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 int64_t resourceId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
365 return transaction_.LookupParent(parentId, resourceId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 bool LookupResource(int64_t& id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 const std::string& publicId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
372 return transaction_.LookupResource(id, type, publicId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 bool LookupResourceAndParent(int64_t& id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 std::string& parentPublicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 const std::string& publicId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
380 return transaction_.LookupResourceAndParent(id, type, parentPublicId, publicId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 }
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
382
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
383 void ListLabels(std::set<std::string>& target,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
384 int64_t id)
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
385 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
386 transaction_.ListLabels(target, id);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
387 }
5249
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5248
diff changeset
388
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5248
diff changeset
389 void ListAllLabels(std::set<std::string>& target)
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5248
diff changeset
390 {
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5248
diff changeset
391 transaction_.ListAllLabels(target);
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5248
diff changeset
392 }
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5522
diff changeset
393
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5522
diff changeset
394 void ExecuteFind(FindResponse& response,
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5605
diff changeset
395 const FindRequest& request)
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5522
diff changeset
396 {
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5605
diff changeset
397 transaction_.ExecuteFind(response, request);
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5522
diff changeset
398 }
5593
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
399
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
400 void ExecuteFind(std::list<std::string>& identifiers,
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5605
diff changeset
401 const FindRequest& request)
5593
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
402 {
5614
4640b7ae9a11 moving normalization of constraints into FindRequest
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5605
diff changeset
403 transaction_.ExecuteFind(identifiers, request);
5593
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
404 }
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
405
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
406 void ExecuteExpand(FindResponse& response,
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
407 const FindRequest& request,
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
408 const std::string& identifier)
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
409 {
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
410 transaction_.ExecuteExpand(response, request, identifier);
862b54b4cfe2 implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5589
diff changeset
411 }
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 class ReadWriteTransaction : public ReadOnlyTransaction
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 public:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
418 ReadWriteTransaction(IDatabaseWrapper::ITransaction& transaction,
5522
dd430a1b21fe simplifying StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5517
diff changeset
419 ITransactionContext& context) :
dd430a1b21fe simplifying StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5517
diff changeset
420 ReadOnlyTransaction(transaction, context)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 void AddAttachment(int64_t id,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
425 const FileInfo& attachment,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
426 int64_t revision)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 {
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
428 transaction_.AddAttachment(id, attachment, revision);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 void ClearChanges()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
433 transaction_.ClearChanges();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 void ClearExportedResources()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
438 transaction_.ClearExportedResources();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 void ClearMainDicomTags(int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
443 return transaction_.ClearMainDicomTags(id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 bool CreateInstance(IDatabaseWrapper::CreateInstanceResult& result, /* out */
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 int64_t& instanceId, /* out */
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 const std::string& patient,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 const std::string& study,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 const std::string& series,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451 const std::string& instance)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
453 return transaction_.CreateInstance(result, instanceId, patient, study, series, instance);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 void DeleteAttachment(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 FileContentType attachment)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
459 return transaction_.DeleteAttachment(id, attachment);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 void DeleteMetadata(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 MetadataType type)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
465 transaction_.DeleteMetadata(id, type);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 void DeleteResource(int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
470 transaction_.DeleteResource(id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 void LogChange(int64_t internalId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 ChangeType changeType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 ResourceType resourceType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 void LogExportedResource(const ExportedResource& resource)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
480 transaction_.LogExportedResource(resource);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 void SetGlobalProperty(GlobalProperty property,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
484 bool shared,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 const std::string& value)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 {
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
487 transaction_.SetGlobalProperty(property, shared, value);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
490 int64_t IncrementGlobalProperty(GlobalProperty sequence,
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
491 bool shared,
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
492 int64_t increment)
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
493 {
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
494 return transaction_.IncrementGlobalProperty(sequence, shared, increment);
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
495 }
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
496
5466
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
497 void UpdateAndGetStatistics(int64_t& patientsCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
498 int64_t& studiesCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
499 int64_t& seriesCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
500 int64_t& instancesCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
501 int64_t& compressedSize,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
502 int64_t& uncompressedSize)
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
503 {
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
504 return transaction_.UpdateAndGetStatistics(patientsCount, studiesCount, seriesCount, instancesCount, compressedSize, uncompressedSize);
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
505 }
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
506
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 void SetMetadata(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 MetadataType type,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
509 const std::string& value,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
510 int64_t revision)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 {
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
512 return transaction_.SetMetadata(id, type, value, revision);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 void SetProtectedPatient(int64_t internalId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516 bool isProtected)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
518 transaction_.SetProtectedPatient(internalId, isProtected);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 void SetResourcesContent(const ResourcesContent& content)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
523 transaction_.SetResourcesContent(content);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 void Recycle(uint64_t maximumStorageSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 unsigned int maximumPatients,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 uint64_t addedInstanceSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 const std::string& newPatientId);
5061
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
530
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
531 bool HasReachedMaxStorageSize(uint64_t maximumStorageSize,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
532 uint64_t addedInstanceSize);
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
533
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
534 bool HasReachedMaxPatientCount(unsigned int maximumPatientCount,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
535 const std::string& patientId);
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
536
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
537 bool IsRecyclingNeeded(uint64_t maximumStorageSize,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
538 unsigned int maximumPatients,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
539 uint64_t addedInstanceSize,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
540 const std::string& newPatientId);
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
541
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
542 void AddLabel(int64_t id,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
543 const std::string& label)
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
544 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
545 transaction_.AddLabel(id, label);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
546 }
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
547
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
548 void RemoveLabel(int64_t id,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
549 const std::string& label)
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
550 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
551 transaction_.RemoveLabel(id, label);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
552 }
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 class IReadOnlyOperations : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 virtual ~IReadOnlyOperations()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 virtual void Apply(ReadOnlyTransaction& transaction) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 class IReadWriteOperations : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 virtual ~IReadWriteOperations()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 virtual void Apply(ReadWriteTransaction& transaction) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 private:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 class Transaction;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
581 IDatabaseWrapper& db_;
4613
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
582 boost::shared_ptr<MainDicomTagsRegistry> mainDicomTagsRegistry_; // "shared_ptr" because of PImpl
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
583
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
584 // Mutex to protect the configuration options
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
585 boost::shared_mutex mutex_;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 std::unique_ptr<ITransactionContextFactory> factory_;
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
587 unsigned int maxRetries_;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 void NormalizeLookup(std::vector<DatabaseConstraint>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 const DatabaseLookup& source,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 ResourceType level) const;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 void ApplyInternal(IReadOnlyOperations* readOperations,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 IReadWriteOperations* writeOperations);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 protected:
5061
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
597 void StandaloneRecycling(MaxStorageMode maximumStorageMode,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
598 uint64_t maximumStorageSize,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 unsigned int maximumPatientCount);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 public:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
602 explicit StatelessDatabaseOperations(IDatabaseWrapper& database);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 void SetTransactionContextFactory(ITransactionContextFactory* factory /* takes ownership */);
4613
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
605
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
606 // Only used to handle "ErrorCode_DatabaseCannotSerialize" in the
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
607 // case of collision between multiple writers
2684544ff03c maximum number of database retries for writer collisions is now set by the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4607
diff changeset
608 void SetMaxDatabaseRetries(unsigned int maxRetries);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 // It is assumed that "GetDatabaseVersion()" can run out of a
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 // database transaction
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 unsigned int GetDatabaseVersion()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 return db_.GetDatabaseVersion();
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616
5517
0d433132b249 refactoring IDatabaseWrapper::Capabilities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5497
diff changeset
617 const IDatabaseWrapper::Capabilities GetDatabaseCapabilities() const
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
618 {
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
619 return db_.GetDatabaseCapabilities();
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
620 }
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
621
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
622 void FlushToDisk();
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
623
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
624
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 void Apply(IReadOnlyOperations& operations);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 void Apply(IReadWriteOperations& operations);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
629 bool ExpandResource(ExpandedResource& target,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 const std::string& publicId,
4697
569d9ef165b1 Added "short", "simplify" and/or "full" options to control the format of DICOM tags wherever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4694
diff changeset
631 ResourceType level,
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4939
diff changeset
632 const std::set<DicomTag>& requestedTags,
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
633 ExpandResourceFlags expandFlags);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 void GetAllMetadata(std::map<MetadataType, std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 ResourceType level);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 void GetAllUuids(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 ResourceType resourceType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 void GetAllUuids(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 ResourceType resourceType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 size_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
645 uint32_t limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 void GetGlobalStatistics(/* out */ uint64_t& diskSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 /* out */ uint64_t& uncompressedSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 /* out */ uint64_t& countPatients,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 /* out */ uint64_t& countStudies,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 /* out */ uint64_t& countSeries,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 /* out */ uint64_t& countInstances);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 bool LookupAttachment(FileInfo& attachment,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
655 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 const std::string& instancePublicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 FileContentType contentType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 void GetChanges(Json::Value& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
661 uint32_t limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 void GetLastChange(Json::Value& target);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 void GetExportedResources(Json::Value& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
667 uint32_t limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 void GetLastExportedResource(Json::Value& target);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 bool IsProtectedPatient(const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 void GetChildren(std::list<std::string>& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 void GetChildInstances(std::list<std::string>& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 bool LookupMetadata(std::string& target,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
680 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 ResourceType expectedType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 MetadataType type);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 void ListAvailableAttachments(std::set<FileContentType>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 ResourceType expectedType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 bool LookupParent(std::string& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 void GetResourceStatistics(/* out */ ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 /* out */ uint64_t& diskSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 /* out */ uint64_t& uncompressedSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 /* out */ unsigned int& countStudies,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 /* out */ unsigned int& countSeries,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 /* out */ unsigned int& countInstances,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 /* out */ uint64_t& dicomDiskSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 /* out */ uint64_t& dicomUncompressedSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 void LookupIdentifierExact(std::vector<std::string>& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 ResourceType level,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 const DicomTag& tag,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 const std::string& value);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 bool LookupGlobalProperty(std::string& value,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
708 GlobalProperty property,
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
709 bool shared);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 std::string GetGlobalProperty(GlobalProperty property,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
712 bool shared,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 const std::string& defaultValue);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 bool GetMainDicomTags(DicomMap& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 ResourceType expectedType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 ResourceType levelOfInterest);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 // Only applicable at the instance level
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 bool GetAllMainDicomTags(DicomMap& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 const std::string& instancePublicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724 bool LookupResourceType(ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 bool LookupParent(std::string& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 ResourceType parentType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 void ApplyLookupResources(std::vector<std::string>& resourcesId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 std::vector<std::string>* instancesId, // Can be NULL if not needed
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 const DatabaseLookup& lookup,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 ResourceType queryLevel,
5248
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
735 const std::set<std::string>& labels,
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
736 LabelsConstraint labelsConstraint,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
737 uint32_t limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738
4694
da1edb7d6332 "/tools/bulk-delete" to delete a group of multiple, unrelated resources at once
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4640
diff changeset
739 bool DeleteResource(Json::Value& remainingAncestor /* out */,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 const std::string& uuid,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 ResourceType expectedType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 void LogExportedResource(const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 const std::string& remoteModality);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 void SetProtectedPatient(const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 bool isProtected);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
749 void SetMetadata(int64_t& newRevision /*out*/,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
750 const std::string& publicId,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 MetadataType type,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
752 const std::string& value,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
753 bool hasOldRevision,
4640
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
754 int64_t oldRevision,
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
755 const std::string& oldMD5);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
757 // Same as "SetMetadata()", but doesn't care about revisions
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
758 void OverwriteMetadata(const std::string& publicId,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
759 MetadataType type,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
760 const std::string& value);
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
761
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
762 bool DeleteMetadata(const std::string& publicId,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
763 MetadataType type,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
764 bool hasRevision,
4640
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
765 int64_t revision,
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
766 const std::string& md5);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
768 uint64_t IncrementGlobalSequence(GlobalProperty sequence,
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
769 bool shared);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 void DeleteChanges();
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 void DeleteExportedResources();
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 void SetGlobalProperty(GlobalProperty property,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
776 bool shared,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 const std::string& value);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
779 bool DeleteAttachment(const std::string& publicId,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
780 FileContentType type,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
781 bool hasRevision,
4640
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
782 int64_t revision,
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
783 const std::string& md5);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
785 void LogChange(int64_t internalId,
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
786 ChangeType changeType,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788 ResourceType level);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5522
diff changeset
790 void ReconstructInstance(const ParsedDicomFile& dicom,
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5522
diff changeset
791 bool limitToThisLevelDicomTags,
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5522
diff changeset
792 ResourceType limitToLevel_);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 const DicomMap& dicomSummary,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 const Attachments& attachments,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 const MetadataMap& metadata,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798 const DicomInstanceOrigin& origin,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 bool overwrite,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800 bool hasTransferSyntax,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 DicomTransferSyntax transferSyntax,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 bool hasPixelDataOffset,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 uint64_t pixelDataOffset,
5316
03501a258d9e added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5277
diff changeset
804 ValueRepresentation pixelDataVR,
5061
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
805 MaxStorageMode maximumStorageMode,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806 uint64_t maximumStorageSize,
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
807 unsigned int maximumPatients,
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
808 bool isReconstruct);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
810 StoreStatus AddAttachment(int64_t& newRevision /*out*/,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
811 const FileInfo& attachment,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 uint64_t maximumStorageSize,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
814 unsigned int maximumPatients,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
815 bool hasOldRevision,
4640
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
816 int64_t oldRevision,
66109d24d26e "ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4627
diff changeset
817 const std::string& oldMd5);
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
818
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
819 void ListLabels(std::set<std::string>& target,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
820 const std::string& publicId,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
821 ResourceType level);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
822
5249
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5248
diff changeset
823 void ListAllLabels(std::set<std::string>& target);
f22c8fac764b added "/tools/labels" to list all the labels that are associated with any resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5248
diff changeset
824
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
825 void ModifyLabel(const std::string& publicId,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
826 ResourceType level,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
827 const std::string& label,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
828 LabelOperation operation);
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5237
diff changeset
829
5495
4b3f5986eca1 Added a 'KeepLabels' option in /modify routes (default = false)
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
830 void AddLabels(const std::string& publicId,
4b3f5986eca1 Added a 'KeepLabels' option in /modify routes (default = false)
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
831 ResourceType level,
4b3f5986eca1 Added a 'KeepLabels' option in /modify routes (default = false)
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
832 const std::set<std::string>& labels);
4b3f5986eca1 Added a 'KeepLabels' option in /modify routes (default = false)
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
833
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5237
diff changeset
834 bool HasLabelsSupport();
5554
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5522
diff changeset
835
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5522
diff changeset
836 void ExecuteFind(FindResponse& response,
12d8a1a266e9 introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5522
diff changeset
837 const FindRequest& request);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839 }