Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Engine/OrthancPluginDatabase.h @ 5455:176bc05f85f4 pg-transactions
DB: new Capabilities class to manage future new methods from DB plugins + Added IncrementGlobalProperty
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 07 Dec 2023 12:04:11 +0100 |
parents | df39c7583a49 |
children | b3ebe249ed5b |
comparison
equal
deleted
inserted
replaced
5454:099d45f49fe1 | 5455:176bc05f85f4 |
---|---|
23 #pragma once | 23 #pragma once |
24 | 24 |
25 #if ORTHANC_ENABLE_PLUGINS == 1 | 25 #if ORTHANC_ENABLE_PLUGINS == 1 |
26 | 26 |
27 #include "../../../OrthancFramework/Sources/SharedLibrary.h" | 27 #include "../../../OrthancFramework/Sources/SharedLibrary.h" |
28 #include "../../Sources/Database/IDatabaseWrapper.h" | 28 #include "../../Sources/Database/BaseDatabaseWrapper.h" |
29 #include "../Include/orthanc/OrthancCDatabasePlugin.h" | 29 #include "../Include/orthanc/OrthancCDatabasePlugin.h" |
30 #include "PluginsErrorDictionary.h" | 30 #include "PluginsErrorDictionary.h" |
31 | 31 |
32 #include <boost/thread/recursive_mutex.hpp> | 32 #include <boost/thread/recursive_mutex.hpp> |
33 | 33 |
43 * the SQLite model. Read-write accesses assumed the plugin to run | 43 * the SQLite model. Read-write accesses assumed the plugin to run |
44 * the SQL statement "START TRANSACTION SERIALIZABLE" so as to be | 44 * the SQL statement "START TRANSACTION SERIALIZABLE" so as to be |
45 * able to rollback the modifications. Read-only accesses didn't | 45 * able to rollback the modifications. Read-only accesses didn't |
46 * start a transaction, as they were protected by the global mutex. | 46 * start a transaction, as they were protected by the global mutex. |
47 **/ | 47 **/ |
48 class OrthancPluginDatabase : public IDatabaseWrapper | 48 class OrthancPluginDatabase : public BaseDatabaseWrapper |
49 { | 49 { |
50 private: | 50 private: |
51 class Transaction; | 51 class Transaction; |
52 | 52 |
53 /** | 53 /** |
63 OrthancPluginDatabaseExtensions extensions_; | 63 OrthancPluginDatabaseExtensions extensions_; |
64 void* payload_; | 64 void* payload_; |
65 Transaction* activeTransaction_; | 65 Transaction* activeTransaction_; |
66 bool fastGetTotalSize_; | 66 bool fastGetTotalSize_; |
67 uint64_t currentDiskSize_; | 67 uint64_t currentDiskSize_; |
68 IDatabaseWrapper::Capabilities dbCapabilities_; | |
68 | 69 |
69 OrthancPluginDatabaseContext* GetContext() | 70 OrthancPluginDatabaseContext* GetContext() |
70 { | 71 { |
71 return reinterpret_cast<OrthancPluginDatabaseContext*>(this); | 72 return reinterpret_cast<OrthancPluginDatabaseContext*>(this); |
72 } | 73 } |
92 | 93 |
93 virtual void FlushToDisk() ORTHANC_OVERRIDE | 94 virtual void FlushToDisk() ORTHANC_OVERRIDE |
94 { | 95 { |
95 } | 96 } |
96 | 97 |
97 virtual bool HasFlushToDisk() const ORTHANC_OVERRIDE | |
98 { | |
99 return false; | |
100 } | |
101 | |
102 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type, | 98 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type, |
103 IDatabaseListener& listener) | 99 IDatabaseListener& listener) |
104 ORTHANC_OVERRIDE; | 100 ORTHANC_OVERRIDE; |
105 | 101 |
106 virtual unsigned int GetDatabaseVersion() ORTHANC_OVERRIDE; | 102 virtual unsigned int GetDatabaseVersion() ORTHANC_OVERRIDE; |
107 | 103 |
108 virtual void Upgrade(unsigned int targetVersion, | 104 virtual void Upgrade(unsigned int targetVersion, |
109 IStorageArea& storageArea) ORTHANC_OVERRIDE; | 105 IStorageArea& storageArea) ORTHANC_OVERRIDE; |
110 | 106 |
111 virtual bool HasRevisionsSupport() const ORTHANC_OVERRIDE | 107 const IDatabaseWrapper::Capabilities& GetDatabaseCapabilities() const ORTHANC_OVERRIDE |
112 { | 108 { |
113 return false; // No support for revisions in old API | 109 return dbCapabilities_; |
114 } | 110 } |
115 | 111 |
116 virtual bool HasLabelsSupport() const ORTHANC_OVERRIDE | |
117 { | |
118 return false; | |
119 } | |
120 | 112 |
121 void AnswerReceived(const _OrthancPluginDatabaseAnswer& answer); | 113 void AnswerReceived(const _OrthancPluginDatabaseAnswer& answer); |
122 }; | 114 }; |
123 } | 115 } |
124 | 116 |