diff OrthancServer/ServerIndex.h @ 511:3b735fdf320b

monitoring of stable patients/studies/series
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Aug 2013 15:39:53 +0200
parents 23e5b35e3c5c
children 2c739f76d0bb
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.h	Fri Aug 16 14:23:54 2013 +0200
+++ b/OrthancServer/ServerIndex.h	Fri Aug 16 15:39:53 2013 +0200
@@ -34,6 +34,7 @@
 
 #include <boost/thread.hpp>
 #include <boost/noncopyable.hpp>
+#include "../Core/Cache/LeastRecentlyUsedIndex.h"
 #include "../Core/SQLite/Connection.h"
 #include "../Core/DicomFormat/DicomMap.h"
 #include "../Core/DicomFormat/DicomInstanceHasher.h"
@@ -55,17 +56,25 @@
   {
   private:
     class Transaction;
+    struct UnstableResourcePayload;
 
+    bool done_;
     boost::mutex mutex_;
     boost::thread flushThread_;
+    boost::thread unstableResourcesMonitorThread_;
 
     std::auto_ptr<Internals::ServerIndexListener> listener_;
     std::auto_ptr<DatabaseWrapper> db_;
+    LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload>  unstableResources_;
 
     uint64_t currentStorageSize_;
     uint64_t maximumStorageSize_;
     unsigned int maximumPatients_;
 
+    static void FlushThread(ServerIndex* that);
+
+    static void UnstableResourcesMonitorThread(ServerIndex* that);
+
     void MainDicomTagsToJson(Json::Value& result,
                              int64_t resourceId);
 
@@ -78,6 +87,9 @@
 
     void StandaloneRecycling();
 
+    void MarkAsUnstable(int64_t id,
+                        Orthanc::ResourceType type);
+
   public:
     typedef std::list<FileInfo> Attachments;