Mercurial > hg > orthanc
annotate OrthancServer/IDatabaseWrapper.h @ 2667:5fa2f2ce74f0 jobs
serialization of JobsRegistry
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 08 Jun 2018 15:48:35 +0200 |
parents | 878b59270859 |
children | e583478e0c6c |
rev | line source |
---|---|
1247 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1286
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
2447
878b59270859
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
1247 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
36 #include "../Core/DicomFormat/DicomMap.h" | |
37 #include "../Core/SQLite/ITransaction.h" | |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
38 #include "../Core/FileStorage/IStorageArea.h" |
1247 | 39 #include "../Core/FileStorage/FileInfo.h" |
1432
0ac74fa21db8
rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1306
diff
changeset
|
40 #include "IDatabaseListener.h" |
1247 | 41 #include "ExportedResource.h" |
42 | |
43 #include <list> | |
44 #include <boost/noncopyable.hpp> | |
45 | |
46 namespace Orthanc | |
47 { | |
48 class IDatabaseWrapper : public boost::noncopyable | |
49 { | |
50 public: | |
51 virtual ~IDatabaseWrapper() | |
52 { | |
53 } | |
54 | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
55 virtual void Open() = 0; |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
56 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
57 virtual void Close() = 0; |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
58 |
1247 | 59 virtual void AddAttachment(int64_t id, |
60 const FileInfo& attachment) = 0; | |
61 | |
62 virtual void AttachChild(int64_t parent, | |
63 int64_t child) = 0; | |
64 | |
1286 | 65 virtual void ClearChanges() = 0; |
66 | |
67 virtual void ClearExportedResources() = 0; | |
1247 | 68 |
69 virtual int64_t CreateResource(const std::string& publicId, | |
70 ResourceType type) = 0; | |
71 | |
72 virtual void DeleteAttachment(int64_t id, | |
73 FileContentType attachment) = 0; | |
74 | |
75 virtual void DeleteMetadata(int64_t id, | |
76 MetadataType type) = 0; | |
77 | |
78 virtual void DeleteResource(int64_t id) = 0; | |
79 | |
80 virtual void FlushToDisk() = 0; | |
81 | |
1306
8cd5784a6d80
IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1302
diff
changeset
|
82 virtual bool HasFlushToDisk() const = 0; |
8cd5784a6d80
IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1302
diff
changeset
|
83 |
1301 | 84 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
1247 | 85 int64_t id) = 0; |
86 | |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1746
diff
changeset
|
87 virtual void GetAllInternalIds(std::list<int64_t>& target, |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1746
diff
changeset
|
88 ResourceType resourceType) = 0; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1746
diff
changeset
|
89 |
1247 | 90 virtual void GetAllPublicIds(std::list<std::string>& target, |
91 ResourceType resourceType) = 0; | |
92 | |
1509
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
93 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
|
94 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
|
95 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
|
96 size_t limit) = 0; |
1247 | 97 |
98 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, | |
99 bool& done /*out*/, | |
100 int64_t since, | |
1302 | 101 uint32_t maxResults) = 0; |
1247 | 102 |
1301 | 103 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
1247 | 104 int64_t id) = 0; |
105 | |
1301 | 106 virtual void GetChildrenPublicId(std::list<std::string>& target, |
1247 | 107 int64_t id) = 0; |
108 | |
109 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, | |
110 bool& done /*out*/, | |
111 int64_t since, | |
1302 | 112 uint32_t maxResults) = 0; |
1247 | 113 |
114 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) = 0; | |
115 | |
116 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) = 0; | |
117 | |
118 virtual void GetMainDicomTags(DicomMap& map, | |
119 int64_t id) = 0; | |
120 | |
121 virtual std::string GetPublicId(int64_t resourceId) = 0; | |
122 | |
123 virtual uint64_t GetResourceCount(ResourceType resourceType) = 0; | |
124 | |
125 virtual ResourceType GetResourceType(int64_t resourceId) = 0; | |
126 | |
127 virtual uint64_t GetTotalCompressedSize() = 0; | |
128 | |
129 virtual uint64_t GetTotalUncompressedSize() = 0; | |
130 | |
131 virtual bool IsExistingResource(int64_t internalId) = 0; | |
132 | |
133 virtual bool IsProtectedPatient(int64_t internalId) = 0; | |
134 | |
135 virtual void ListAvailableMetadata(std::list<MetadataType>& target, | |
136 int64_t id) = 0; | |
137 | |
1301 | 138 virtual void ListAvailableAttachments(std::list<FileContentType>& target, |
1247 | 139 int64_t id) = 0; |
140 | |
141 virtual void LogChange(int64_t internalId, | |
142 const ServerIndexChange& change) = 0; | |
143 | |
144 virtual void LogExportedResource(const ExportedResource& resource) = 0; | |
145 | |
146 virtual bool LookupAttachment(FileInfo& attachment, | |
147 int64_t id, | |
148 FileContentType contentType) = 0; | |
149 | |
150 virtual bool LookupGlobalProperty(std::string& target, | |
151 GlobalProperty property) = 0; | |
152 | |
1746 | 153 virtual void LookupIdentifier(std::list<int64_t>& result, |
154 ResourceType level, | |
155 const DicomTag& tag, | |
156 IdentifierConstraintType type, | |
157 const std::string& value) = 0; | |
1729 | 158 |
1247 | 159 virtual bool LookupMetadata(std::string& target, |
160 int64_t id, | |
161 MetadataType type) = 0; | |
162 | |
163 virtual bool LookupParent(int64_t& parentId, | |
164 int64_t resourceId) = 0; | |
165 | |
1294 | 166 virtual bool LookupResource(int64_t& id, |
167 ResourceType& type, | |
168 const std::string& publicId) = 0; | |
1247 | 169 |
170 virtual bool SelectPatientToRecycle(int64_t& internalId) = 0; | |
171 | |
172 virtual bool SelectPatientToRecycle(int64_t& internalId, | |
173 int64_t patientIdToAvoid) = 0; | |
174 | |
175 virtual void SetGlobalProperty(GlobalProperty property, | |
176 const std::string& value) = 0; | |
177 | |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1615
diff
changeset
|
178 virtual void ClearMainDicomTags(int64_t id) = 0; |
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1615
diff
changeset
|
179 |
1286 | 180 virtual void SetMainDicomTag(int64_t id, |
181 const DicomTag& tag, | |
182 const std::string& value) = 0; | |
1247 | 183 |
1713 | 184 virtual void SetIdentifierTag(int64_t id, |
185 const DicomTag& tag, | |
186 const std::string& value) = 0; | |
187 | |
1247 | 188 virtual void SetMetadata(int64_t id, |
189 MetadataType type, | |
190 const std::string& value) = 0; | |
191 | |
192 virtual void SetProtectedPatient(int64_t internalId, | |
193 bool isProtected) = 0; | |
194 | |
195 virtual SQLite::ITransaction* StartTransaction() = 0; | |
196 | |
1432
0ac74fa21db8
rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1306
diff
changeset
|
197 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
|
198 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
199 virtual unsigned int GetDatabaseVersion() = 0; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
200 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
201 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
|
202 IStorageArea& storageArea) = 0; |
1247 | 203 }; |
204 } |