changeset 270:e6a4c4329481

parameters for storage capacity
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Dec 2012 15:01:12 +0100
parents f6fdf5abe751
children 98d78841066a
files OrthancServer/OrthancInitialization.h OrthancServer/ServerIndex.cpp OrthancServer/main.cpp Resources/Configuration.json
diffstat 4 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.h	Fri Dec 07 14:46:44 2012 +0100
+++ b/OrthancServer/OrthancInitialization.h	Fri Dec 07 15:01:12 2012 +0100
@@ -35,6 +35,7 @@
 #include <string>
 #include <set>
 #include <json/json.h>
+#include <stdint.h>
 #include "../Core/HttpServer/MongooseServer.h"
 
 namespace Orthanc
--- a/OrthancServer/ServerIndex.cpp	Fri Dec 07 14:46:44 2012 +0100
+++ b/OrthancServer/ServerIndex.cpp	Fri Dec 07 15:01:12 2012 +0100
@@ -838,6 +838,16 @@
   {
     boost::mutex::scoped_lock lock(mutex_);
     maximumPatients_ = count;
+
+    if (count == 0)
+    {
+      LOG(WARNING) << "No limit on the number of stored patients";
+    }
+    else
+    {
+      LOG(WARNING) << "At most " << count << " patients will be stored";
+    }
+
     StandaloneRecycling();
   }
 
@@ -845,6 +855,16 @@
   {
     boost::mutex::scoped_lock lock(mutex_);
     maximumStorageSize_ = size;
+
+    if (size == 0)
+    {
+      LOG(WARNING) << "No limit on the size of the storage area";
+    }
+    else
+    {
+      LOG(WARNING) << "At most " << (size / (1024 * 1024)) << "MB will be used for the storage area";
+    }
+
     StandaloneRecycling();
   }
 
--- a/OrthancServer/main.cpp	Fri Dec 07 14:46:44 2012 +0100
+++ b/OrthancServer/main.cpp	Fri Dec 07 15:01:12 2012 +0100
@@ -214,6 +214,25 @@
     ServerContext context(storageDirectory);
     context.SetCompressionEnabled(GetGlobalBoolParameter("StorageCompression", false));
 
+    try
+    {
+      context.GetIndex().SetMaximumPatientCount(GetGlobalIntegerParameter("MaximumPatientCount", 0));
+    }
+    catch (...)
+    {
+      context.GetIndex().SetMaximumPatientCount(0);
+    }
+
+    try
+    {
+      uint64_t size = GetGlobalIntegerParameter("MaximumStorageSize", 0);
+      context.GetIndex().SetMaximumStorageSize(size * 1024 * 1024);
+    }
+    catch (...)
+    {
+      context.GetIndex().SetMaximumStorageSize(0);
+    }
+
     MyDicomStoreFactory storeScp(context);
 
     {
--- a/Resources/Configuration.json	Fri Dec 07 14:46:44 2012 +0100
+++ b/Resources/Configuration.json	Fri Dec 07 15:01:12 2012 +0100
@@ -13,6 +13,14 @@
     // Enable the transparent compression of the DICOM instances
     "StorageCompression" : false,
 
+    // Maximum size of the storage in MB (a value of "0" indicates no
+    // limit on the storage size)
+    "MaximumStorageSize" : 0,
+
+    // Maximum number of patients that can be stored at a given time
+    // in the storage (a value of "0" indicates no limit on the number
+    // of patients)
+    "MaximumPatientCount" : 0,
 
 
     /**