annotate OrthancServer/Sources/Database/StatelessDatabaseOperations.h @ 5640:f7adfb22e20e

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 21:19:57 +0200
parents b2a97dfd719f
children 3f13db27b399 3765085693e5 e47ac5e133b1
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include "IDatabaseWrapper.h"
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include "../DicomInstanceOrigin.h"
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
4594
d494b4f1103e removed the global database mutex from ServerIndex and StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4591
diff changeset
31 #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
32 #include <boost/thread/shared_mutex.hpp>
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
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 namespace Orthanc
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 class DatabaseLookup;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 class ParsedDicomFile;
4588
94147ce2f097 fix build on os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4587
diff changeset
39 struct ServerIndexChange;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
41 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
42 {
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
43 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
44 std::string id_;
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
45 ResourceType level_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
46 DicomMap tags_; // all main tags and main sequences from DB
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
47
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
48 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
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57
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 // 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
59 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
60
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 // 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
62 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
63 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
64
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 // 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
66 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
67 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
68 int indexInSeries_;
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
69
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
70 // New in Orthanc 1.12.0
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
71 std::set<std::string> labels_;
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
72
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
73 public:
5277
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
74 // TODO - Cleanup
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
75 ExpandedResource() :
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
76 level_(ResourceType_Instance),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
77 isStable_(false),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
78 expectedNumberOfInstances_(0),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
79 fileSize_(0),
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
80 indexInSeries_(0)
acaea72a3e91 Orthanc-1.12.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5249
diff changeset
81 {
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
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
84 void SetResource(ResourceType level,
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
85 const std::string& id)
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
86 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
87 level_ = level;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
88 id_ = id;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
89 }
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 const std::string& GetPublicId() const
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
92 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
93 return id_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
94 }
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 ResourceType GetLevel() const
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
97 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
98 return level_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
99 }
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 DicomMap& GetMainDicomTags()
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
102 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
103 return tags_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
104 }
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 const DicomMap& GetMainDicomTags() const
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
107 {
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
108 return tags_;
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
109 }
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
110 };
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
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
112 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
113 {
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
114 ExpandResourceFlags_None = 0,
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
115 ExpandResourceFlags_IncludeMetadata = (1 << 0),
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
116 ExpandResourceFlags_IncludeChildren = (1 << 1),
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
117 ExpandResourceFlags_IncludeMainDicomTags = (1 << 2),
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
118 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
119
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
120 ExpandResourceFlags_Default = (ExpandResourceFlags_IncludeMetadata |
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
121 ExpandResourceFlags_IncludeChildren |
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
122 ExpandResourceFlags_IncludeMainDicomTags |
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
123 ExpandResourceFlags_IncludeLabels)
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
124 };
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
125
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 class StatelessDatabaseOperations : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 typedef std::list<FileInfo> Attachments;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 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
131
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
132 enum LabelOperation
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
133 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
134 LabelOperation_Add,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
135 LabelOperation_Remove
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
136 };
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
137
4589
bec74e29f86b attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4588
diff changeset
138 class ITransactionContext : public IDatabaseListener
4586
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 virtual ~ITransactionContext()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 virtual void Commit() = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 virtual int64_t GetCompressedSizeDelta() = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
5603
b2a97dfd719f monitoring of stable resources now also considers the resource type
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5558
diff changeset
149 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
150 int64_t id) = 0;
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 virtual bool LookupRemainingLevel(std::string& remainingPublicId /* out */,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 ResourceType& remainingLevel /* out */) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
5603
b2a97dfd719f monitoring of stable resources now also considers the resource type
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5558
diff changeset
155 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
156 int64_t id,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 const std::string& publicId) = 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 void SignalAttachmentsAdded(uint64_t compressedSize) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 virtual void SignalChange(const ServerIndexChange& change) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 };
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 class ITransactionContextFactory : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 virtual ~ITransactionContextFactory()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 {
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
4594
d494b4f1103e removed the global database mutex from ServerIndex and StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4591
diff changeset
172 // 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
173 virtual ITransactionContext* Create() = 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 ReadOnlyTransaction : 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 private:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 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
181
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 protected:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
183 IDatabaseWrapper::ITransaction& transaction_;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 public:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
186 explicit ReadOnlyTransaction(IDatabaseWrapper::ITransaction& transaction,
5522
dd430a1b21fe simplifying StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5517
diff changeset
187 ITransactionContext& context) :
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 context_(context),
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
189 transaction_(transaction)
4586
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 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 ITransactionContext& GetTransactionContext()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 return context_;
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 /**
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 * Higher-level constructions
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 **/
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 SeriesStatus GetSeriesStatus(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 int64_t expectedNumberOfInstances);
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
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 * Read-only methods from "IDatabaseWrapper"
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 void ApplyLookupResources(std::list<std::string>& resourcesId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 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
212 const std::vector<DatabaseConstraint>& lookup,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 ResourceType queryLevel,
5248
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
214 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
215 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
216 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 {
5248
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
218 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
219 labels, labelsConstraint, limit);
4586
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 GetAllMetadata(std::map<MetadataType, std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
225 transaction_.GetAllMetadata(target, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 void GetAllPublicIds(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 ResourceType resourceType)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
231 return transaction_.GetAllPublicIds(target, resourceType);
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 GetAllPublicIds(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 ResourceType resourceType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 size_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
237 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
239 return transaction_.GetAllPublicIds(target, resourceType, since, limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 void GetChanges(std::list<ServerIndexChange>& target /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 bool& done /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
245 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 {
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
247 transaction_.GetChanges(target, done, since, limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 void GetChildrenInternalId(std::list<int64_t>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
253 transaction_.GetChildrenInternalId(target, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 void GetChildrenPublicId(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
259 transaction_.GetChildrenPublicId(target, id);
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 GetExportedResources(std::list<ExportedResource>& target /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 bool& done /*out*/,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
265 uint32_t limit)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 {
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
267 return transaction_.GetExportedResources(target, done, since, limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 void GetLastChange(std::list<ServerIndexChange>& target /*out*/)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
272 transaction_.GetLastChange(target);
4586
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 void GetLastExportedResource(std::list<ExportedResource>& target /*out*/)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
277 return transaction_.GetLastExportedResource(target);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 int64_t GetLastChangeIndex()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
282 return transaction_.GetLastChangeIndex();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 void GetMainDicomTags(DicomMap& map,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
288 transaction_.GetMainDicomTags(map, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 }
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 std::string GetPublicId(int64_t resourceId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
293 return transaction_.GetPublicId(resourceId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4594
diff changeset
296 uint64_t GetResourcesCount(ResourceType resourceType)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 {
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4594
diff changeset
298 return transaction_.GetResourcesCount(resourceType);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 ResourceType GetResourceType(int64_t resourceId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
303 return transaction_.GetResourceType(resourceId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 uint64_t GetTotalCompressedSize()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
308 return transaction_.GetTotalCompressedSize();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 uint64_t GetTotalUncompressedSize()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
313 return transaction_.GetTotalUncompressedSize();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 bool IsProtectedPatient(int64_t internalId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
318 return transaction_.IsProtectedPatient(internalId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 void ListAvailableAttachments(std::set<FileContentType>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
324 transaction_.ListAvailableAttachments(target, id);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 }
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 bool LookupAttachment(FileInfo& attachment,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
328 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 FileContentType contentType)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 {
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
332 return transaction_.LookupAttachment(attachment, revision, id, contentType);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 bool LookupGlobalProperty(std::string& target,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
336 GlobalProperty property,
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
337 bool shared)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 {
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
339 return transaction_.LookupGlobalProperty(target, property, shared);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342 bool LookupMetadata(std::string& target,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
343 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 MetadataType type)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 {
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
347 return transaction_.LookupMetadata(target, revision, id, type);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 bool LookupParent(int64_t& parentId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 int64_t resourceId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
353 return transaction_.LookupParent(parentId, resourceId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 bool LookupResource(int64_t& id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 const std::string& publicId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
360 return transaction_.LookupResource(id, type, publicId);
4586
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 bool LookupResourceAndParent(int64_t& id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 std::string& parentPublicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 const std::string& publicId)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
368 return transaction_.LookupResourceAndParent(id, type, parentPublicId, publicId);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 }
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
370
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
371 void ListLabels(std::set<std::string>& target,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
372 int64_t id)
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
373 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
374 transaction_.ListLabels(target, id);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
375 }
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
376
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
377 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
378 {
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
379 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
380 }
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 class ReadWriteTransaction : public ReadOnlyTransaction
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 public:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
387 ReadWriteTransaction(IDatabaseWrapper::ITransaction& transaction,
5522
dd430a1b21fe simplifying StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5517
diff changeset
388 ITransactionContext& context) :
dd430a1b21fe simplifying StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5517
diff changeset
389 ReadOnlyTransaction(transaction, context)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 void AddAttachment(int64_t id,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
394 const FileInfo& attachment,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
395 int64_t revision)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 {
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
397 transaction_.AddAttachment(id, attachment, revision);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 void ClearChanges()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
402 transaction_.ClearChanges();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 void ClearExportedResources()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
407 transaction_.ClearExportedResources();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 void ClearMainDicomTags(int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
412 return transaction_.ClearMainDicomTags(id);
4586
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 bool CreateInstance(IDatabaseWrapper::CreateInstanceResult& result, /* out */
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 int64_t& instanceId, /* out */
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 const std::string& patient,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 const std::string& study,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 const std::string& series,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 const std::string& instance)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
422 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
423 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 void DeleteAttachment(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 FileContentType attachment)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
428 return transaction_.DeleteAttachment(id, attachment);
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 DeleteMetadata(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 MetadataType type)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
434 transaction_.DeleteMetadata(id, type);
4586
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 void DeleteResource(int64_t id)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
439 transaction_.DeleteResource(id);
4586
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 void LogChange(int64_t internalId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 ChangeType changeType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 ResourceType resourceType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 void LogExportedResource(const ExportedResource& resource)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
449 transaction_.LogExportedResource(resource);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 void SetGlobalProperty(GlobalProperty property,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
453 bool shared,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 const std::string& value)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 {
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
456 transaction_.SetGlobalProperty(property, shared, value);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458
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
459 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
460 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
461 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
462 {
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
463 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
464 }
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
465
5466
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
466 void UpdateAndGetStatistics(int64_t& patientsCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
467 int64_t& studiesCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
468 int64_t& seriesCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
469 int64_t& instancesCount,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
470 int64_t& compressedSize,
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
471 int64_t& uncompressedSize)
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
472 {
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
473 return transaction_.UpdateAndGetStatistics(patientsCount, studiesCount, seriesCount, instancesCount, compressedSize, uncompressedSize);
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
474 }
dceed5e3d6a9 new DB plugin primitive: UpdateAndGetStatistics
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
475
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 void SetMetadata(int64_t id,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 MetadataType type,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
478 const std::string& value,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
479 int64_t revision)
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 {
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
481 return transaction_.SetMetadata(id, type, value, revision);
4586
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 void SetProtectedPatient(int64_t internalId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 bool isProtected)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
487 transaction_.SetProtectedPatient(internalId, isProtected);
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
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 void SetResourcesContent(const ResourcesContent& content)
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
492 transaction_.SetResourcesContent(content);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 void Recycle(uint64_t maximumStorageSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 unsigned int maximumPatients,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 uint64_t addedInstanceSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 const std::string& newPatientId);
5061
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
499
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
500 bool HasReachedMaxStorageSize(uint64_t maximumStorageSize,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
501 uint64_t addedInstanceSize);
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
502
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
503 bool HasReachedMaxPatientCount(unsigned int maximumPatientCount,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
504 const std::string& patientId);
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
505
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
506 bool IsRecyclingNeeded(uint64_t maximumStorageSize,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
507 unsigned int maximumPatients,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
508 uint64_t addedInstanceSize,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
509 const std::string& newPatientId);
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
510
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
511 void AddLabel(int64_t id,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
512 const std::string& label)
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
513 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
514 transaction_.AddLabel(id, label);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
515 }
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
516
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
517 void RemoveLabel(int64_t id,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
518 const std::string& label)
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
519 {
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
520 transaction_.RemoveLabel(id, label);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
521 }
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523
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 class IReadOnlyOperations : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 virtual ~IReadOnlyOperations()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 virtual void Apply(ReadOnlyTransaction& transaction) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 class IReadWriteOperations : public boost::noncopyable
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 public:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 virtual ~IReadWriteOperations()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 virtual void Apply(ReadWriteTransaction& transaction) = 0;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 private:
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 class MainDicomTagsRegistry;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 class Transaction;
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
551 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
552 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
553
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
554 // 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
555 boost::shared_mutex mutex_;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 std::unique_ptr<ITransactionContextFactory> factory_;
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
557 unsigned int maxRetries_;
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 void NormalizeLookup(std::vector<DatabaseConstraint>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 const DatabaseLookup& source,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 ResourceType level) const;
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 void ApplyInternal(IReadOnlyOperations* readOperations,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 IReadWriteOperations* writeOperations);
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 protected:
5061
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
567 void StandaloneRecycling(MaxStorageMode maximumStorageMode,
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
568 uint64_t maximumStorageSize,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 unsigned int maximumPatientCount);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 public:
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4589
diff changeset
572 explicit StatelessDatabaseOperations(IDatabaseWrapper& database);
4586
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 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
575
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
576 // 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
577 // 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
578 void SetMaxDatabaseRetries(unsigned int maxRetries);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 // 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
581 // database transaction
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 unsigned int GetDatabaseVersion()
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 {
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 return db_.GetDatabaseVersion();
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 }
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586
5517
0d433132b249 refactoring IDatabaseWrapper::Capabilities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5497
diff changeset
587 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
588 {
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
589 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
590 }
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5316
diff changeset
591
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
592 void FlushToDisk();
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
593
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
594
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 void Apply(IReadOnlyOperations& operations);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 void Apply(IReadWriteOperations& operations);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598
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
599 bool ExpandResource(ExpandedResource& target,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600 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
601 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
602 const std::set<DicomTag>& requestedTags,
5222
3a61fd50f804 starting refactoring ExpandedResource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5221
diff changeset
603 ExpandResourceFlags expandFlags);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 void GetAllMetadata(std::map<MetadataType, std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 ResourceType level);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 void GetAllUuids(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 ResourceType resourceType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 void GetAllUuids(std::list<std::string>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 ResourceType resourceType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 size_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
615 uint32_t limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617 void GetGlobalStatistics(/* out */ uint64_t& diskSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 /* out */ uint64_t& uncompressedSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 /* out */ uint64_t& countPatients,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 /* out */ uint64_t& countStudies,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621 /* out */ uint64_t& countSeries,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 /* out */ uint64_t& countInstances);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624 bool LookupAttachment(FileInfo& attachment,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
625 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 const std::string& instancePublicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 FileContentType contentType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 void GetChanges(Json::Value& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
631 uint32_t limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 void GetLastChange(Json::Value& target);
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 GetExportedResources(Json::Value& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 int64_t since,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
637 uint32_t limit);
4586
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 GetLastExportedResource(Json::Value& target);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 bool IsProtectedPatient(const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 void GetChildren(std::list<std::string>& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 void GetChildInstances(std::list<std::string>& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 bool LookupMetadata(std::string& target,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
650 int64_t& revision,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 ResourceType expectedType,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 MetadataType type);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 void ListAvailableAttachments(std::set<FileContentType>& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 ResourceType expectedType);
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 bool LookupParent(std::string& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 void GetResourceStatistics(/* out */ ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 /* out */ uint64_t& diskSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664 /* out */ uint64_t& uncompressedSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 /* out */ unsigned int& countStudies,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 /* out */ unsigned int& countSeries,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 /* out */ unsigned int& countInstances,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 /* out */ uint64_t& dicomDiskSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 /* out */ uint64_t& dicomUncompressedSize,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 void LookupIdentifierExact(std::vector<std::string>& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 ResourceType level,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 const DicomTag& tag,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 const std::string& value);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 bool LookupGlobalProperty(std::string& value,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
678 GlobalProperty property,
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
679 bool shared);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 std::string GetGlobalProperty(GlobalProperty property,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
682 bool shared,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 const std::string& defaultValue);
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 bool GetMainDicomTags(DicomMap& result,
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 ResourceType levelOfInterest);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 // Only applicable at the instance level
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 bool GetAllMainDicomTags(DicomMap& result,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 const std::string& instancePublicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 bool LookupResourceType(ResourceType& type,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 const std::string& publicId);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 bool LookupParent(std::string& target,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 ResourceType parentType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 void ApplyLookupResources(std::vector<std::string>& resourcesId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 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
703 const DatabaseLookup& lookup,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 ResourceType queryLevel,
5248
a7d95f951f8a replaced "WithLabels" and "WithoutLabels", by "Labels" and "LabelsConstraint"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5238
diff changeset
705 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
706 LabelsConstraint labelsConstraint,
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
707 uint32_t limit);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708
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
709 bool DeleteResource(Json::Value& remainingAncestor /* out */,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710 const std::string& uuid,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 ResourceType expectedType);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 void LogExportedResource(const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 const std::string& remoteModality);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 void SetProtectedPatient(const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 bool isProtected);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
719 void SetMetadata(int64_t& newRevision /*out*/,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
720 const std::string& publicId,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 MetadataType type,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
722 const std::string& value,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
723 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
724 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
725 const std::string& oldMD5);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
727 // 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
728 void OverwriteMetadata(const std::string& publicId,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
729 MetadataType type,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
730 const std::string& value);
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
731
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
732 bool DeleteMetadata(const std::string& publicId,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
733 MetadataType type,
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4613
diff changeset
734 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
735 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
736 const std::string& md5);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
738 uint64_t IncrementGlobalSequence(GlobalProperty sequence,
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
739 bool shared);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 void DeleteChanges();
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 DeleteExportedResources();
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 void SetGlobalProperty(GlobalProperty property,
4607
f75c63aa9de0 differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
746 bool shared,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 const std::string& value);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
749 bool DeleteAttachment(const std::string& publicId,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
750 FileContentType type,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
751 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
752 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
753 const std::string& md5);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754
4587
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
755 void LogChange(int64_t internalId,
888868a5dc4e ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4586
diff changeset
756 ChangeType changeType,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 ResourceType level);
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5522
diff changeset
760 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
761 bool limitToThisLevelDicomTags,
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5522
diff changeset
762 ResourceType limitToLevel_);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 const DicomMap& dicomSummary,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 const Attachments& attachments,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 const MetadataMap& metadata,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 const DicomInstanceOrigin& origin,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 bool overwrite,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770 bool hasTransferSyntax,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 DicomTransferSyntax transferSyntax,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 bool hasPixelDataOffset,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 uint64_t pixelDataOffset,
5316
03501a258d9e added instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5277
diff changeset
774 ValueRepresentation pixelDataVR,
5061
e95fadefeb72 new MaximumStorageMode configuration
Alain Mazy <am@osimis.io>
parents: 5044
diff changeset
775 MaxStorageMode maximumStorageMode,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 uint64_t maximumStorageSize,
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
777 unsigned int maximumPatients,
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
778 bool isReconstruct);
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
780 StoreStatus AddAttachment(int64_t& newRevision /*out*/,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
781 const FileInfo& attachment,
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 const std::string& publicId,
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 uint64_t maximumStorageSize,
4627
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
784 unsigned int maximumPatients,
f7d5372b59b3 handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4623
diff changeset
785 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
786 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
787 const std::string& oldMd5);
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
788
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
789 void ListLabels(std::set<std::string>& target,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
790 const std::string& publicId,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
791 ResourceType level);
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
792
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
793 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
794
5221
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
795 void ModifyLabel(const std::string& publicId,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
796 ResourceType level,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
797 const std::string& label,
d0f7c742d397 started implementation of labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
798 LabelOperation operation);
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5237
diff changeset
799
5495
4b3f5986eca1 Added a 'KeepLabels' option in /modify routes (default = false)
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
800 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
801 ResourceType level,
4b3f5986eca1 Added a 'KeepLabels' option in /modify routes (default = false)
Alain Mazy <am@osimis.io>
parents: 5485
diff changeset
802 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
803
5238
367e8af46cfd added "HasLabels" in /system
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5237
diff changeset
804 bool HasLabelsSupport();
4586
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 };
1d96fe7e054e taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806 }