Mercurial > hg > orthanc
diff OrthancServer/Sources/Database/StatelessDatabaseOperations.h @ 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 | 95ffe3b6ef7c |
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Wed Apr 07 10:41:39 2021 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Thu Apr 08 10:46:12 2021 +0200 @@ -39,6 +39,7 @@ #include "../DicomInstanceOrigin.h" #include <boost/shared_ptr.hpp> +#include <boost/thread/shared_mutex.hpp> namespace Orthanc @@ -408,10 +409,13 @@ class Transaction; IDatabaseWrapper& db_; + boost::shared_ptr<MainDicomTagsRegistry> mainDicomTagsRegistry_; // "shared_ptr" because of PImpl + bool hasFlushToDisk_; + + // Mutex to protect the configuration options + boost::shared_mutex mutex_; std::unique_ptr<ITransactionContextFactory> factory_; unsigned int maxRetries_; - boost::shared_ptr<MainDicomTagsRegistry> mainDicomTagsRegistry_; // "shared_ptr" because of PImpl - bool hasFlushToDisk_; void NormalizeLookup(std::vector<DatabaseConstraint>& target, const DatabaseLookup& source, @@ -428,6 +432,10 @@ explicit StatelessDatabaseOperations(IDatabaseWrapper& database); void SetTransactionContextFactory(ITransactionContextFactory* factory /* takes ownership */); + + // Only used to handle "ErrorCode_DatabaseCannotSerialize" in the + // case of collision between multiple writers + void SetMaxDatabaseRetries(unsigned int maxRetries); // It is assumed that "GetDatabaseVersion()" can run out of a // database transaction