Mercurial > hg > orthanc-databases
annotate PostgreSQL/Plugins/PostgreSQLIndex.h @ 82:122f22550521 db-changes
integration mainline->db-changes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jan 2019 13:33:33 +0100 |
parents | cb0aac9bbada |
children | 1012fe77241c |
rev | line source |
---|---|
0 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
67 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "../../Framework/Plugins/IndexBackend.h" | |
25 #include "../../Framework/PostgreSQL/PostgreSQLParameters.h" | |
26 | |
27 namespace OrthancDatabases | |
28 { | |
29 class PostgreSQLIndex : public IndexBackend | |
30 { | |
31 private: | |
32 class Factory : public IDatabaseFactory | |
33 { | |
34 private: | |
35 PostgreSQLIndex& that_; | |
36 | |
37 public: | |
38 Factory(PostgreSQLIndex& that) : | |
39 that_(that) | |
40 { | |
41 } | |
42 | |
43 virtual Dialect GetDialect() const | |
44 { | |
45 return Dialect_PostgreSQL; | |
46 } | |
47 | |
48 virtual IDatabase* Open() | |
49 { | |
50 return that_.OpenInternal(); | |
51 } | |
52 }; | |
53 | |
54 OrthancPluginContext* context_; | |
55 PostgreSQLParameters parameters_; | |
56 bool clearAll_; | |
57 | |
58 IDatabase* OpenInternal(); | |
59 | |
60 public: | |
61 PostgreSQLIndex(const PostgreSQLParameters& parameters); | |
62 | |
63 void SetOrthancPluginContext(OrthancPluginContext* context) | |
64 { | |
65 context_ = context; | |
66 } | |
67 | |
68 void SetClearAll(bool clear) | |
69 { | |
70 clearAll_ = clear; | |
71 } | |
72 | |
73 virtual int64_t CreateResource(const char* publicId, | |
72
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
74 OrthancPluginResourceType type) |
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
75 ORTHANC_OVERRIDE; |
71
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
76 |
72
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
77 virtual uint64_t GetTotalCompressedSize() ORTHANC_OVERRIDE; |
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
78 |
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
79 virtual uint64_t GetTotalUncompressedSize() ORTHANC_OVERRIDE; |
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
80 |
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
81 virtual bool HasCreateInstance() const ORTHANC_OVERRIDE |
71
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
82 { |
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
83 return true; |
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
84 } |
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
85 |
78 | 86 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 |
71
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
87 virtual void CreateInstance(OrthancPluginCreateInstanceResult& result, |
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
88 const char* hashPatient, |
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
89 const char* hashStudy, |
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
90 const char* hashSeries, |
72
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
91 const char* hashInstance) |
8dd29af7c844
new extension: FastTotalSize
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
71
diff
changeset
|
92 ORTHANC_OVERRIDE; |
71
d40c5fecd160
new extension implemented for PostgreSQL: CreateInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
67
diff
changeset
|
93 #endif |
79
cb0aac9bbada
optimization for /statistics URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
78
diff
changeset
|
94 |
cb0aac9bbada
optimization for /statistics URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
78
diff
changeset
|
95 virtual uint64_t GetResourceCount(OrthancPluginResourceType resourceType) |
cb0aac9bbada
optimization for /statistics URI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
78
diff
changeset
|
96 ORTHANC_OVERRIDE; |
0 | 97 }; |
98 } |