annotate OrthancServer/Database/IDatabaseWrapper.h @ 3743:33c19a6643e1

creating IDicomTranscoder abstraction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Mar 2020 16:08:08 +0100
parents 94f4a18a79cc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1750
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1286
diff changeset
4 * Department, University Hospital of Liege, Belgium
3640
94f4a18a79cc upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3187
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
3093
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
36 #include "../../Core/DicomFormat/DicomMap.h"
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
37 #include "../../Core/FileStorage/FileInfo.h"
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
38 #include "../../Core/FileStorage/IStorageArea.h"
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
39 #include "../../Core/SQLite/ITransaction.h"
3025
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3020
diff changeset
40
3093
2e1808b6146a reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3091
diff changeset
41 #include "../ExportedResource.h"
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3093
diff changeset
42 #include "IDatabaseListener.h"
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 #include <list>
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 #include <boost/noncopyable.hpp>
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 namespace Orthanc
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
3100
f6de9d25b20d removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
49 class DatabaseConstraint;
3083
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
50 class ResourcesContent;
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
51
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
52
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 class IDatabaseWrapper : public boost::noncopyable
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 public:
3019
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
56 class ITransaction : public boost::noncopyable
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
57 {
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
58 public:
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
59 virtual ~ITransaction()
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
60 {
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
61 }
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
62
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
63 virtual void Begin() = 0;
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
64
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
65 virtual void Rollback() = 0;
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
66
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
67 virtual void Commit(int64_t fileSizeDelta) = 0;
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
68 };
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
69
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
70
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
71 struct CreateInstanceResult
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
72 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
73 bool isNewPatient_;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
74 bool isNewStudy_;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
75 bool isNewSeries_;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
76 int64_t patientId_;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
77 int64_t studyId_;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
78 int64_t seriesId_;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
79 };
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
80
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 virtual ~IDatabaseWrapper()
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 {
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
1672
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
85 virtual void Open() = 0;
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
86
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
87 virtual void Close() = 0;
4c5a85c3ff43 sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1668
diff changeset
88
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 virtual void AddAttachment(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 const FileInfo& attachment) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
1286
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
92 virtual void ClearChanges() = 0;
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
93
b4acdb37e43b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1252
diff changeset
94 virtual void ClearExportedResources() = 0;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 virtual void DeleteAttachment(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 FileContentType attachment) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 virtual void DeleteMetadata(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 MetadataType type) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 virtual void DeleteResource(int64_t id) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 virtual void FlushToDisk() = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
1306
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
106 virtual bool HasFlushToDisk() const = 0;
8cd5784a6d80 IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1302
diff changeset
107
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
108 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 int64_t id) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 virtual void GetAllPublicIds(std::list<std::string>& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 ResourceType resourceType) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
1509
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
114 virtual void GetAllPublicIds(std::list<std::string>& target,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
115 ResourceType resourceType,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
116 size_t since,
0586ed8897f1 limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1432
diff changeset
117 size_t limit) = 0;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 bool& done /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 int64_t since,
1302
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1301
diff changeset
122 uint32_t maxResults) = 0;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
124 virtual void GetChildrenInternalId(std::list<int64_t>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 int64_t id) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
127 virtual void GetChildrenPublicId(std::list<std::string>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 int64_t id) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 bool& done /*out*/,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 int64_t since,
1302
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1301
diff changeset
133 uint32_t maxResults) = 0;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 virtual void GetMainDicomTags(DicomMap& map,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 int64_t id) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 virtual std::string GetPublicId(int64_t resourceId) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 virtual uint64_t GetResourceCount(ResourceType resourceType) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 virtual ResourceType GetResourceType(int64_t resourceId) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 virtual uint64_t GetTotalCompressedSize() = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 virtual uint64_t GetTotalUncompressedSize() = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 virtual bool IsExistingResource(int64_t internalId) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 virtual bool IsProtectedPatient(int64_t internalId) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1294
diff changeset
156 virtual void ListAvailableAttachments(std::list<FileContentType>& target,
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 int64_t id) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 virtual void LogChange(int64_t internalId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 const ServerIndexChange& change) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 virtual void LogExportedResource(const ExportedResource& resource) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 virtual bool LookupAttachment(FileInfo& attachment,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 FileContentType contentType) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 virtual bool LookupGlobalProperty(std::string& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 GlobalProperty property) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 virtual bool LookupMetadata(std::string& target,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 MetadataType type) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 virtual bool LookupParent(int64_t& parentId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 int64_t resourceId) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
1294
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
178 virtual bool LookupResource(int64_t& id,
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
179 ResourceType& type,
910478b2d4e4 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
180 const std::string& publicId) = 0;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 virtual bool SelectPatientToRecycle(int64_t& internalId) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 virtual bool SelectPatientToRecycle(int64_t& internalId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 int64_t patientIdToAvoid) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 virtual void SetGlobalProperty(GlobalProperty property,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 const std::string& value) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1615
diff changeset
190 virtual void ClearMainDicomTags(int64_t id) = 0;
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1615
diff changeset
191
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 virtual void SetMetadata(int64_t id,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 MetadataType type,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 const std::string& value) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 virtual void SetProtectedPatient(int64_t internalId,
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 bool isProtected) = 0;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
3019
8336204d95dc refactoring computation of disk size for recycling
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2697
diff changeset
199 virtual ITransaction* StartTransaction() = 0;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
1432
0ac74fa21db8 rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1306
diff changeset
201 virtual void SetListener(IDatabaseListener& listener) = 0;
1615
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
202
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
203 virtual unsigned int GetDatabaseVersion() = 0;
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
204
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
205 virtual void Upgrade(unsigned int targetVersion,
c40fe92a68e7 Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1509
diff changeset
206 IStorageArea& storageArea) = 0;
3020
d207f6ac1f86 tracking disk size by the database engine to ensure consistency across transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3019
diff changeset
207
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
208
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
209 /**
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
210 * Primitives introduced in Orthanc 1.5.2
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
211 **/
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
212
3020
d207f6ac1f86 tracking disk size by the database engine to ensure consistency across transactions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3019
diff changeset
213 virtual bool IsDiskSizeAbove(uint64_t threshold) = 0;
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
214
3075
ead8576a02ef IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
215 virtual void ApplyLookupResources(std::list<std::string>& resourcesId,
ead8576a02ef IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
216 std::list<std::string>* instancesId, // Can be NULL if not needed
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3027
diff changeset
217 const std::vector<DatabaseConstraint>& lookup,
3025
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3020
diff changeset
218 ResourceType queryLevel,
039a9d262d64 preparing to speed up find in databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3020
diff changeset
219 size_t limit) = 0;
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
220
3116
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
221 // Returns "true" iff. the instance is new and has been inserted
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
222 // into the database. If "false" is returned, the content of
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
223 // "result" is undefined, but "instanceId" must be properly
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
224 // set. This method must also tag the parent patient as the most
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
225 // recent in the patient recycling order if it is not protected
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3105
diff changeset
226 // (so as to fix issue #58).
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
227 virtual bool CreateInstance(CreateInstanceResult& result, /* out */
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
228 int64_t& instanceId, /* out */
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
229 const std::string& patient,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
230 const std::string& study,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3075
diff changeset
231 const std::string& series,
3082
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
232 const std::string& instance) = 0;
3083
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
233
3089
fb8ee0786b1e new extension for database plugin SDK: setResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
234 // It is guaranteed that the resources to be modified have no main
fb8ee0786b1e new extension for database plugin SDK: setResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
235 // DICOM tags, and no DICOM identifiers associated with
fb8ee0786b1e new extension for database plugin SDK: setResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
236 // them. However, some metadata might be already existing, and
fb8ee0786b1e new extension for database plugin SDK: setResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3083
diff changeset
237 // have to be overwritten.
3083
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
238 virtual void SetResourcesContent(const ResourcesContent& content) = 0;
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3089
diff changeset
239
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3089
diff changeset
240 virtual void GetChildrenMetadata(std::list<std::string>& target,
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3089
diff changeset
241 int64_t resourceId,
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3089
diff changeset
242 MetadataType metadata) = 0;
3105
2e1711f80f74 More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3100
diff changeset
243
2e1711f80f74 More consistent handling of the "Last" field returned by the "/changes" URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3100
diff changeset
244 virtual int64_t GetLastChangeIndex() = 0;
3187
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
245
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
246
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
247 /**
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
248 * Primitives introduced in Orthanc 1.5.4
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
249 **/
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
250
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
251 virtual bool LookupResourceAndParent(int64_t& id,
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
252 ResourceType& type,
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
253 std::string& parentPublicId,
4bbadcd03966 refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3116
diff changeset
254 const std::string& publicId) = 0;
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 };
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 }