annotate OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.h @ 5516:d9c9f3c57f4f pg-transactions

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Jan 2024 18:18:07 +0100
parents 4dd50c4b985a
children 0d433132b249
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5220
diff changeset
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #if ORTHANC_ENABLE_PLUGINS == 1
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "../../../OrthancFramework/Sources/SharedLibrary.h"
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5220
diff changeset
28 #include "../../Sources/Database/BaseDatabaseWrapper.h"
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include "../Include/orthanc/OrthancCDatabasePlugin.h"
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include "PluginsErrorDictionary.h"
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 namespace Orthanc
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5220
diff changeset
34 class OrthancPluginDatabaseV3 : public BaseDatabaseWrapper
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 private:
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 class Transaction;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 SharedLibrary& library_;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 PluginsErrorDictionary& errorDictionary_;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 OrthancPluginDatabaseBackendV3 backend_;
4601
27c07dbf6b4f check whether the database plugin interface is entirely implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4595
diff changeset
42 void* database_;
4604
2c702cfae274 New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4601
diff changeset
43 std::string serverIdentifier_;
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5220
diff changeset
44 IDatabaseWrapper::Capabilities dbCapabilities_;
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4604
diff changeset
46 void CheckSuccess(OrthancPluginErrorCode code) const;
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 public:
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 OrthancPluginDatabaseV3(SharedLibrary& library,
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 PluginsErrorDictionary& errorDictionary,
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 const OrthancPluginDatabaseBackendV3* backend,
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 size_t backendSize,
4604
2c702cfae274 New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4601
diff changeset
53 void* database,
2c702cfae274 New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4601
diff changeset
54 const std::string& serverIdentifier);
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 virtual ~OrthancPluginDatabaseV3();
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 virtual void Open() ORTHANC_OVERRIDE;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 virtual void Close() ORTHANC_OVERRIDE;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 const SharedLibrary& GetSharedLibrary() const
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 return library_;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 virtual void FlushToDisk() ORTHANC_OVERRIDE
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type,
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 IDatabaseListener& listener)
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 ORTHANC_OVERRIDE;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 virtual unsigned int GetDatabaseVersion() ORTHANC_OVERRIDE;
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 virtual void Upgrade(unsigned int targetVersion,
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 IStorageArea& storageArea) ORTHANC_OVERRIDE;
4628
5fabef29c4ff added new primitive "hasRevisionsSupport" in database SDK, added "CheckRevisions" to URI "/system"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4604
diff changeset
79
5493
b3ebe249ed5b At startup, when using a database plugin, display the latency to access the DB
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
80 virtual uint64_t MeasureLatency() ORTHANC_OVERRIDE
b3ebe249ed5b At startup, when using a database plugin, display the latency to access the DB
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
81 {
b3ebe249ed5b At startup, when using a database plugin, display the latency to access the DB
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
82 throw OrthancException(ErrorCode_NotImplemented); // only implemented in V4
b3ebe249ed5b At startup, when using a database plugin, display the latency to access the DB
Alain Mazy <am@osimis.io>
parents: 5455
diff changeset
83 }
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
84
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5220
diff changeset
85 const IDatabaseWrapper::Capabilities& GetDatabaseCapabilities() const ORTHANC_OVERRIDE
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
86 {
5455
176bc05f85f4 DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
Alain Mazy <am@osimis.io>
parents: 5220
diff changeset
87 return dbCapabilities_;
5220
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
88 }
df39c7583a49 preparing virtual methods for labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
89
4595
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 };
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 }
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
cc64385593ef added OrthancPluginRegisterDatabaseBackendV3() to plugin sdk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 #endif