changeset 5819:7c2b4fa94633 find-refactoring

ReadOnly transactions
author Alain Mazy <am@orthanc.team>
date Fri, 27 Sep 2024 14:38:20 +0200
parents 272b0d0eef38
children ca5622c27d6c 881cd0965146
files OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp OrthancServer/Sources/Database/StatelessDatabaseOperations.h OrthancServer/Sources/ServerIndex.cpp
diffstat 3 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Thu Sep 26 17:23:43 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp	Fri Sep 27 14:38:20 2024 +0200
@@ -2825,8 +2825,8 @@
   }
 
 
-  bool StatelessDatabaseOperations::ReadWriteTransaction::HasReachedMaxStorageSize(uint64_t maximumStorageSize,
-                                                                                   uint64_t addedInstanceSize)
+  bool StatelessDatabaseOperations::ReadOnlyTransaction::HasReachedMaxStorageSize(uint64_t maximumStorageSize,
+                                                                                  uint64_t addedInstanceSize)
   {
     if (maximumStorageSize != 0)
     {
@@ -2847,8 +2847,8 @@
     return false;
   }                                                                           
 
-  bool StatelessDatabaseOperations::ReadWriteTransaction::HasReachedMaxPatientCount(unsigned int maximumPatientCount,
-                                                                                    const std::string& patientId)
+  bool StatelessDatabaseOperations::ReadOnlyTransaction::HasReachedMaxPatientCount(unsigned int maximumPatientCount,
+                                                                                   const std::string& patientId)
   {
     if (maximumPatientCount != 0)
     {
--- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Thu Sep 26 17:23:43 2024 +0200
+++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h	Fri Sep 27 14:38:20 2024 +0200
@@ -401,6 +401,12 @@
         transaction_.ListAllLabels(target);
       }
 
+      bool HasReachedMaxStorageSize(uint64_t maximumStorageSize,
+                                    uint64_t addedInstanceSize);
+
+      bool HasReachedMaxPatientCount(unsigned int maximumPatientCount,
+                                     const std::string& patientId);
+
       void ExecuteFind(FindResponse& response,
                        const FindRequest& request,
                        const IDatabaseWrapper::Capabilities& capabilities)
@@ -541,12 +547,6 @@
                    uint64_t addedInstanceSize,
                    const std::string& newPatientId);
 
-      bool HasReachedMaxStorageSize(uint64_t maximumStorageSize,
-                                    uint64_t addedInstanceSize);
-
-      bool HasReachedMaxPatientCount(unsigned int maximumPatientCount,
-                                     const std::string& patientId);
-      
       bool IsRecyclingNeeded(uint64_t maximumStorageSize,
                              unsigned int maximumPatients,
                              uint64_t addedInstanceSize,
--- a/OrthancServer/Sources/ServerIndex.cpp	Thu Sep 26 17:23:43 2024 +0200
+++ b/OrthancServer/Sources/ServerIndex.cpp	Fri Sep 27 14:38:20 2024 +0200
@@ -271,7 +271,7 @@
   {
     Logging::SetCurrentThreadName("DB-STATS");
 
-    static const unsigned int SLEEP_SECONDS = 60;
+    static const unsigned int SLEEP_SECONDS = 10;
 
     if (threadSleepGranularityMilliseconds > 1000)
     {