comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4613:2684544ff03c db-changes

maximum number of database retries for writer collisions is now set by the plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 08 Apr 2021 10:46:12 +0200
parents f75c63aa9de0
children 6c4081ae3bb8
comparison
equal deleted inserted replaced
4612:4982733a4e39 4613:2684544ff03c
1210 char** argv_; 1210 char** argv_;
1211 std::unique_ptr<OrthancPluginDatabase> database_; 1211 std::unique_ptr<OrthancPluginDatabase> database_;
1212 std::unique_ptr<OrthancPluginDatabaseV3> databaseV3_; // New in Orthanc 1.9.2 1212 std::unique_ptr<OrthancPluginDatabaseV3> databaseV3_; // New in Orthanc 1.9.2
1213 PluginsErrorDictionary dictionary_; 1213 PluginsErrorDictionary dictionary_;
1214 std::string databaseServerIdentifier_; // New in Orthanc 1.9.2 1214 std::string databaseServerIdentifier_; // New in Orthanc 1.9.2
1215 unsigned int maxDatabaseRetries_; // New in Orthanc 1.9.2
1215 1216
1216 PImpl(const std::string& databaseServerIdentifier) : 1217 PImpl(const std::string& databaseServerIdentifier) :
1217 context_(NULL), 1218 context_(NULL),
1218 findCallback_(NULL), 1219 findCallback_(NULL),
1219 worklistCallback_(NULL), 1220 worklistCallback_(NULL),
1220 argc_(1), 1221 argc_(1),
1221 argv_(NULL), 1222 argv_(NULL),
1222 databaseServerIdentifier_(databaseServerIdentifier) 1223 databaseServerIdentifier_(databaseServerIdentifier),
1224 maxDatabaseRetries_(0)
1223 { 1225 {
1224 memset(&moveCallbacks_, 0, sizeof(moveCallbacks_)); 1226 memset(&moveCallbacks_, 0, sizeof(moveCallbacks_));
1225 } 1227 }
1226 }; 1228 };
1227 1229
5085 if (pimpl_->database_.get() == NULL && 5087 if (pimpl_->database_.get() == NULL &&
5086 pimpl_->databaseV3_.get() == NULL) 5088 pimpl_->databaseV3_.get() == NULL)
5087 { 5089 {
5088 pimpl_->databaseV3_.reset(new OrthancPluginDatabaseV3(plugin, GetErrorDictionary(), p.backend, 5090 pimpl_->databaseV3_.reset(new OrthancPluginDatabaseV3(plugin, GetErrorDictionary(), p.backend,
5089 p.backendSize, p.database, pimpl_->databaseServerIdentifier_)); 5091 p.backendSize, p.database, pimpl_->databaseServerIdentifier_));
5092 pimpl_->maxDatabaseRetries_ = p.maxDatabaseRetries;
5090 } 5093 }
5091 else 5094 else
5092 { 5095 {
5093 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered); 5096 throw OrthancException(ErrorCode_DatabaseBackendAlreadyRegistered);
5094 } 5097 }
5752 bool OrthancPlugins::IsValidAuthorizationToken(const std::string& token) const 5755 bool OrthancPlugins::IsValidAuthorizationToken(const std::string& token) const
5753 { 5756 {
5754 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); 5757 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_);
5755 return (pimpl_->authorizationTokens_.find(token) != pimpl_->authorizationTokens_.end()); 5758 return (pimpl_->authorizationTokens_.find(token) != pimpl_->authorizationTokens_.end());
5756 } 5759 }
5760
5761
5762 unsigned int OrthancPlugins::GetMaxDatabaseRetries() const
5763 {
5764 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_);
5765 return pimpl_->maxDatabaseRetries_;
5766 }
5757 } 5767 }