diff OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp @ 4604:2c702cfae274 db-changes

New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 10:39:59 +0200
parents cfdd1f59ff6f
children f75c63aa9de0
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp	Wed Mar 24 15:30:06 2021 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp	Tue Mar 30 10:39:59 2021 +0200
@@ -696,7 +696,8 @@
     virtual bool LookupGlobalProperty(std::string& target,
                                       GlobalProperty property) ORTHANC_OVERRIDE
     {
-      CheckSuccess(that_.backend_.lookupGlobalProperty(transaction_, static_cast<int32_t>(property)));
+      CheckSuccess(that_.backend_.lookupGlobalProperty(
+                     transaction_, that_.serverIdentifier_.c_str(), static_cast<int32_t>(property)));
       CheckNoEvent();
       return ReadSingleStringAnswer(target);      
     }
@@ -762,7 +763,8 @@
     virtual void SetGlobalProperty(GlobalProperty property,
                                    const std::string& value) ORTHANC_OVERRIDE
     {
-      CheckSuccess(that_.backend_.setGlobalProperty(transaction_, static_cast<int32_t>(property), value.c_str()));
+      CheckSuccess(that_.backend_.setGlobalProperty(transaction_, that_.serverIdentifier_.c_str(),
+                                                    static_cast<int32_t>(property), value.c_str()));
       CheckNoEvent();
     }
 
@@ -1048,11 +1050,16 @@
                                                    PluginsErrorDictionary&  errorDictionary,
                                                    const OrthancPluginDatabaseBackendV3* backend,
                                                    size_t backendSize,
-                                                   void* database) :
+                                                   void* database,
+                                                   const std::string& serverIdentifier) :
     library_(library),
     errorDictionary_(errorDictionary),
-    database_(database)
+    database_(database),
+    serverIdentifier_(serverIdentifier)
   {
+    CLOG(INFO, PLUGINS) << "Identifier of this Orthanc server for the global properties "
+                        << "of the custom database: \"" << serverIdentifier << "\"";
+    
     if (backendSize >= sizeof(backend_))
     {
       memcpy(&backend_, backend, sizeof(backend_));