Mercurial > hg > orthanc
annotate OrthancServer/Sources/Database/StatelessDatabaseOperations.h @ 4961:1b76853e1797 more-tags
DbOptimizer plugin
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 23 Mar 2022 11:56:28 +0100 |
parents | 304514ce84ee |
children | 8fba26292a9f |
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 |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * 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
|
9 * 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
|
10 * 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
|
11 * License, or (at your option) any later version. |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * 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
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * 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
|
16 * General Public License for more details. |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * 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
|
19 * 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
|
20 **/ |
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 #pragma once |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h" |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include "IDatabaseWrapper.h" |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include "../DicomInstanceOrigin.h" |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
4594
d494b4f1103e
removed the global database mutex from ServerIndex and StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4591
diff
changeset
|
30 #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
|
31 #include <boost/thread/shared_mutex.hpp> |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
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 namespace Orthanc |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 class DatabaseLookup; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 class ParsedDicomFile; |
4588 | 38 struct ServerIndexChange; |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 |
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
|
40 struct ExpandedResource : public boost::noncopyable |
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
|
41 { |
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 std::string id_; |
acd3f72e2a21
split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
43 DicomMap tags_; // all tags from DB |
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 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
|
45 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
|
46 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
|
47 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
|
48 ResourceType type_; |
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 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
|
50 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
|
51 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
|
52 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
|
53 |
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 // 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
|
55 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
|
56 |
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 // 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
|
58 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
|
59 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
|
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 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
|
62 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
|
63 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
|
64 int indexInSeries_; |
acd3f72e2a21
split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
65 }; |
acd3f72e2a21
split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents:
4892
diff
changeset
|
66 |
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
|
67 enum ExpandResourceDbFlags |
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
|
68 { |
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
|
69 ExpandResourceDbFlags_None = 0, |
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
|
70 ExpandResourceDbFlags_IncludeMetadata = (1 << 0), |
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
|
71 ExpandResourceDbFlags_IncludeChildren = (1 << 1), |
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
|
72 ExpandResourceDbFlags_IncludeMainDicomTags = (1 << 2), |
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
|
73 |
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
|
74 ExpandResourceDbFlags_Default = (ExpandResourceDbFlags_IncludeMetadata | |
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
|
75 ExpandResourceDbFlags_IncludeChildren | |
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
|
76 ExpandResourceDbFlags_IncludeMainDicomTags) |
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
|
77 }; |
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
|
78 |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 class StatelessDatabaseOperations : public boost::noncopyable |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 public: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 typedef std::list<FileInfo> Attachments; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 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
|
84 |
4589
bec74e29f86b
attaching the listener to transactions in IDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4588
diff
changeset
|
85 class ITransactionContext : public IDatabaseListener |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 public: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 virtual ~ITransactionContext() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 virtual void Commit() = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 virtual int64_t GetCompressedSizeDelta() = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 virtual bool IsUnstableResource(int64_t id) = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 virtual bool LookupRemainingLevel(std::string& remainingPublicId /* out */, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 ResourceType& remainingLevel /* out */) = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 virtual void MarkAsUnstable(int64_t id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 Orthanc::ResourceType type, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 const std::string& publicId) = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 virtual void SignalAttachmentsAdded(uint64_t compressedSize) = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 virtual void SignalChange(const ServerIndexChange& change) = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 }; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 class ITransactionContextFactory : public boost::noncopyable |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 public: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 virtual ~ITransactionContextFactory() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 |
4594
d494b4f1103e
removed the global database mutex from ServerIndex and StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4591
diff
changeset
|
118 // 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
|
119 virtual ITransactionContext* Create() = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 }; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 class ReadOnlyTransaction : public boost::noncopyable |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 private: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 ITransactionContext& context_; |
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 protected: |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
129 IDatabaseWrapper::ITransaction& transaction_; |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 public: |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
132 explicit ReadOnlyTransaction(IDatabaseWrapper::ITransaction& transaction, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 ITransactionContext& context) : |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 context_(context), |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
135 transaction_(transaction) |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 ITransactionContext& GetTransactionContext() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 return context_; |
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 * Higher-level constructions |
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 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 SeriesStatus GetSeriesStatus(int64_t id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 int64_t expectedNumberOfInstances); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 |
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 /** |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 * Read-only methods from "IDatabaseWrapper" |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 **/ |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 void ApplyLookupResources(std::list<std::string>& resourcesId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 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
|
158 const std::vector<DatabaseConstraint>& lookup, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 ResourceType queryLevel, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 size_t limit) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
162 return transaction_.ApplyLookupResources(resourcesId, instancesId, lookup, queryLevel, limit); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 void GetAllMetadata(std::map<MetadataType, std::string>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 int64_t id) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
168 transaction_.GetAllMetadata(target, id); |
4586
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 void GetAllPublicIds(std::list<std::string>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 ResourceType resourceType) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
174 return transaction_.GetAllPublicIds(target, resourceType); |
4586
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 void GetAllPublicIds(std::list<std::string>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 ResourceType resourceType, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 size_t since, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 size_t limit) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
182 return transaction_.GetAllPublicIds(target, resourceType, since, limit); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 } |
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 void GetChanges(std::list<ServerIndexChange>& target /*out*/, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 bool& done /*out*/, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 int64_t since, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 uint32_t maxResults) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
190 transaction_.GetChanges(target, done, since, maxResults); |
4586
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 void GetChildrenInternalId(std::list<int64_t>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 int64_t id) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
196 transaction_.GetChildrenInternalId(target, id); |
4586
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 void GetChildrenPublicId(std::list<std::string>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 int64_t id) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
202 transaction_.GetChildrenPublicId(target, id); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 void GetExportedResources(std::list<ExportedResource>& target /*out*/, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 bool& done /*out*/, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 int64_t since, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 uint32_t maxResults) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
210 return transaction_.GetExportedResources(target, done, since, maxResults); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 void GetLastChange(std::list<ServerIndexChange>& target /*out*/) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
215 transaction_.GetLastChange(target); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
220 return transaction_.GetLastExportedResource(target); |
4586
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 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 int64_t GetLastChangeIndex() |
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 return transaction_.GetLastChangeIndex(); |
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 GetMainDicomTags(DicomMap& map, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 int64_t id) |
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 transaction_.GetMainDicomTags(map, id); |
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 std::string GetPublicId(int64_t resourceId) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
236 return transaction_.GetPublicId(resourceId); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4594
diff
changeset
|
239 uint64_t GetResourcesCount(ResourceType resourceType) |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 { |
4595
cc64385593ef
added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4594
diff
changeset
|
241 return transaction_.GetResourcesCount(resourceType); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 ResourceType GetResourceType(int64_t resourceId) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
246 return transaction_.GetResourceType(resourceId); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 } |
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 uint64_t GetTotalCompressedSize() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
251 return transaction_.GetTotalCompressedSize(); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 uint64_t GetTotalUncompressedSize() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
256 return transaction_.GetTotalUncompressedSize(); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 bool IsProtectedPatient(int64_t internalId) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
261 return transaction_.IsProtectedPatient(internalId); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 void ListAvailableAttachments(std::set<FileContentType>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 int64_t id) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
267 transaction_.ListAvailableAttachments(target, id); |
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 bool LookupAttachment(FileInfo& attachment, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
271 int64_t& revision, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 int64_t id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 FileContentType contentType) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 { |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
275 return transaction_.LookupAttachment(attachment, revision, id, contentType); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 bool LookupGlobalProperty(std::string& target, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
279 GlobalProperty property, |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
280 bool shared) |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 { |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
282 return transaction_.LookupGlobalProperty(target, property, shared); |
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 bool LookupMetadata(std::string& target, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
286 int64_t& revision, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 int64_t id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 MetadataType type) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 { |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
290 return transaction_.LookupMetadata(target, revision, id, type); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 bool LookupParent(int64_t& parentId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 int64_t resourceId) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
296 return transaction_.LookupParent(parentId, resourceId); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 bool LookupResource(int64_t& id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 ResourceType& type, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 const std::string& publicId) |
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_.LookupResource(id, type, publicId); |
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 bool LookupResourceAndParent(int64_t& id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 ResourceType& type, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 std::string& parentPublicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 const std::string& publicId) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
311 return transaction_.LookupResourceAndParent(id, type, parentPublicId, publicId); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 }; |
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 class ReadWriteTransaction : public ReadOnlyTransaction |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 public: |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
319 ReadWriteTransaction(IDatabaseWrapper::ITransaction& transaction, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 ITransactionContext& context) : |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
321 ReadOnlyTransaction(transaction, context) |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 void AddAttachment(int64_t id, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
326 const FileInfo& attachment, |
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
327 int64_t revision) |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 { |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
329 transaction_.AddAttachment(id, attachment, revision); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 void ClearChanges() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
334 transaction_.ClearChanges(); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 void ClearExportedResources() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
339 transaction_.ClearExportedResources(); |
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 void ClearMainDicomTags(int64_t id) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
344 return transaction_.ClearMainDicomTags(id); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 bool CreateInstance(IDatabaseWrapper::CreateInstanceResult& result, /* out */ |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 int64_t& instanceId, /* out */ |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 const std::string& patient, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 const std::string& study, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 const std::string& series, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 const std::string& instance) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
354 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
|
355 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 void DeleteAttachment(int64_t id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 FileContentType attachment) |
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_.DeleteAttachment(id, attachment); |
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 void DeleteMetadata(int64_t id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 MetadataType type) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
366 transaction_.DeleteMetadata(id, type); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 void DeleteResource(int64_t id) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
371 transaction_.DeleteResource(id); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 void LogChange(int64_t internalId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 ChangeType changeType, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 ResourceType resourceType, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 const std::string& publicId); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 void LogExportedResource(const ExportedResource& resource) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
381 transaction_.LogExportedResource(resource); |
4586
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 void SetGlobalProperty(GlobalProperty property, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
385 bool shared, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 const std::string& value) |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 { |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
388 transaction_.SetGlobalProperty(property, shared, value); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 } |
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 void SetMetadata(int64_t id, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 MetadataType type, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
393 const std::string& value, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
394 int64_t revision) |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 { |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
396 return transaction_.SetMetadata(id, type, value, revision); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 } |
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 void SetProtectedPatient(int64_t internalId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 bool isProtected) |
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_.SetProtectedPatient(internalId, isProtected); |
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 SetResourcesContent(const ResourcesContent& content) |
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_.SetResourcesContent(content); |
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 Recycle(uint64_t maximumStorageSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 unsigned int maximumPatients, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 uint64_t addedInstanceSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 const std::string& newPatientId); |
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 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 class IReadOnlyOperations : public boost::noncopyable |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 public: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 virtual ~IReadOnlyOperations() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 virtual void Apply(ReadOnlyTransaction& transaction) = 0; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 }; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 class IReadWriteOperations : public boost::noncopyable |
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 public: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 virtual ~IReadWriteOperations() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 virtual void Apply(ReadWriteTransaction& transaction) = 0; |
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 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 private: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 class MainDicomTagsRegistry; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 class Transaction; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 |
4587
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
443 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
|
444 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
|
445 bool hasFlushToDisk_; |
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
|
446 |
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
|
447 // 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
|
448 boost::shared_mutex mutex_; |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
449 std::unique_ptr<ITransactionContextFactory> factory_; |
4587
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
450 unsigned int maxRetries_; |
4586
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 NormalizeLookup(std::vector<DatabaseConstraint>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 const DatabaseLookup& source, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 ResourceType level) const; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 void ApplyInternal(IReadOnlyOperations* readOperations, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 IReadWriteOperations* writeOperations); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
458 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
459 protected: |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
460 void StandaloneRecycling(uint64_t maximumStorageSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
461 unsigned int maximumPatientCount); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
462 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
463 public: |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4589
diff
changeset
|
464 explicit StatelessDatabaseOperations(IDatabaseWrapper& database); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
465 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
466 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
|
467 |
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
|
468 // 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
|
469 // 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
|
470 void SetMaxDatabaseRetries(unsigned int maxRetries); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
471 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 // 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
|
473 // database transaction |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 unsigned int GetDatabaseVersion() |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 { |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 return db_.GetDatabaseVersion(); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
477 } |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 |
4587
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
479 void FlushToDisk(); |
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
480 |
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
481 bool HasFlushToDisk() const |
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
482 { |
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
483 return hasFlushToDisk_; |
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
484 } |
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
485 |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 void Apply(IReadOnlyOperations& operations); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
487 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 void Apply(IReadWriteOperations& operations); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 |
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
|
490 bool ExpandResource(ExpandedResource& target, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 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
|
492 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
|
493 const std::set<DicomTag>& requestedTags, |
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
|
494 ExpandResourceDbFlags expandFlags); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
495 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
496 void GetAllMetadata(std::map<MetadataType, std::string>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 ResourceType level); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
499 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
500 void GetAllUuids(std::list<std::string>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
501 ResourceType resourceType); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
502 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
503 void GetAllUuids(std::list<std::string>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
504 ResourceType resourceType, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 size_t since, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 size_t limit); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 void GetGlobalStatistics(/* out */ uint64_t& diskSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 /* out */ uint64_t& uncompressedSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 /* out */ uint64_t& countPatients, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 /* out */ uint64_t& countStudies, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
512 /* out */ uint64_t& countSeries, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
513 /* out */ uint64_t& countInstances); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 bool LookupAttachment(FileInfo& attachment, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
516 int64_t& revision, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 const std::string& instancePublicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
518 FileContentType contentType); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 void GetChanges(Json::Value& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
521 int64_t since, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
522 unsigned int maxResults); |
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 void GetLastChange(Json::Value& target); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
525 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
526 void GetExportedResources(Json::Value& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
527 int64_t since, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 unsigned int maxResults); |
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 void GetLastExportedResource(Json::Value& target); |
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 bool IsProtectedPatient(const std::string& publicId); |
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 void GetChildren(std::list<std::string>& result, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 const std::string& publicId); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 void GetChildInstances(std::list<std::string>& result, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 const std::string& publicId); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
539 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 bool LookupMetadata(std::string& target, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
541 int64_t& revision, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 ResourceType expectedType, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 MetadataType type); |
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 void ListAvailableAttachments(std::set<FileContentType>& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 ResourceType expectedType); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
549 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 bool LookupParent(std::string& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 const std::string& publicId); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
552 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 void GetResourceStatistics(/* out */ ResourceType& type, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 /* out */ uint64_t& diskSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 /* out */ uint64_t& uncompressedSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 /* out */ unsigned int& countStudies, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 /* out */ unsigned int& countSeries, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 /* out */ unsigned int& countInstances, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 /* out */ uint64_t& dicomDiskSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 /* out */ uint64_t& dicomUncompressedSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 const std::string& publicId); |
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 LookupIdentifierExact(std::vector<std::string>& result, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 ResourceType level, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 const DicomTag& tag, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 const std::string& value); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 bool LookupGlobalProperty(std::string& value, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
569 GlobalProperty property, |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
570 bool shared); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
571 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 std::string GetGlobalProperty(GlobalProperty property, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
573 bool shared, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 const std::string& defaultValue); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 bool GetMainDicomTags(DicomMap& result, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 ResourceType expectedType, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 ResourceType levelOfInterest); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 // Only applicable at the instance level |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 bool GetAllMainDicomTags(DicomMap& result, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
583 const std::string& instancePublicId); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 bool LookupResourceType(ResourceType& type, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 const std::string& publicId); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 bool LookupParent(std::string& target, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 ResourceType parentType); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 void ApplyLookupResources(std::vector<std::string>& resourcesId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 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
|
594 const DatabaseLookup& lookup, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 ResourceType queryLevel, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 size_t limit); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
597 |
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
|
598 bool DeleteResource(Json::Value& remainingAncestor /* out */, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
599 const std::string& uuid, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
600 ResourceType expectedType); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
601 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 void LogExportedResource(const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 const std::string& remoteModality); |
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 SetProtectedPatient(const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 bool isProtected); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
608 void SetMetadata(int64_t& newRevision /*out*/, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
609 const std::string& publicId, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 MetadataType type, |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
611 const std::string& value, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
612 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
|
613 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
|
614 const std::string& oldMD5); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 |
4623
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
616 // 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
|
617 void OverwriteMetadata(const std::string& publicId, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
618 MetadataType type, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
619 const std::string& value); |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
620 |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
621 bool DeleteMetadata(const std::string& publicId, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
622 MetadataType type, |
95ffe3b6ef7c
handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4613
diff
changeset
|
623 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
|
624 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
|
625 const std::string& md5); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
626 |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
627 uint64_t IncrementGlobalSequence(GlobalProperty sequence, |
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
628 bool shared); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 void DeleteChanges(); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
631 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
632 void DeleteExportedResources(); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
633 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 void SetGlobalProperty(GlobalProperty property, |
4607
f75c63aa9de0
differentiating between shared and private global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4595
diff
changeset
|
635 bool shared, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 const std::string& value); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
638 bool DeleteAttachment(const std::string& publicId, |
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
639 FileContentType type, |
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
640 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
|
641 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
|
642 const std::string& md5); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 |
4587
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
644 void LogChange(int64_t internalId, |
888868a5dc4e
ServerIndex now uses StatelessDatabaseOperations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4586
diff
changeset
|
645 ChangeType changeType, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 ResourceType level); |
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 void ReconstructInstance(const ParsedDicomFile& dicom); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 StoreStatus Store(std::map<MetadataType, std::string>& instanceMetadata, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 const DicomMap& dicomSummary, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 const Attachments& attachments, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
654 const MetadataMap& metadata, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
655 const DicomInstanceOrigin& origin, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 bool overwrite, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
657 bool hasTransferSyntax, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
658 DicomTransferSyntax transferSyntax, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
659 bool hasPixelDataOffset, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
660 uint64_t pixelDataOffset, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
661 uint64_t maximumStorageSize, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
662 unsigned int maximumPatients); |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
663 |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
664 StoreStatus AddAttachment(int64_t& newRevision /*out*/, |
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
665 const FileInfo& attachment, |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
666 const std::string& publicId, |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
667 uint64_t maximumStorageSize, |
4627
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
668 unsigned int maximumPatients, |
f7d5372b59b3
handling revisions of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4623
diff
changeset
|
669 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
|
670 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
|
671 const std::string& oldMd5); |
4586
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 }; |
1d96fe7e054e
taking StatelessDatabaseOperations out of ServerIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
673 } |