Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.h @ 546:0e510ea3de31 laaw
merge mainline -> laaw
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 13 Sep 2013 11:25:08 +0200 |
parents | 2c739f76d0bb |
children | b2357f1f026f |
comparison
equal
deleted
inserted
replaced
543:fe796b053863 | 546:0e510ea3de31 |
---|---|
32 | 32 |
33 #pragma once | 33 #pragma once |
34 | 34 |
35 #include <boost/thread.hpp> | 35 #include <boost/thread.hpp> |
36 #include <boost/noncopyable.hpp> | 36 #include <boost/noncopyable.hpp> |
37 #include "../Core/Cache/LeastRecentlyUsedIndex.h" | |
37 #include "../Core/SQLite/Connection.h" | 38 #include "../Core/SQLite/Connection.h" |
38 #include "../Core/DicomFormat/DicomMap.h" | 39 #include "../Core/DicomFormat/DicomMap.h" |
39 #include "../Core/DicomFormat/DicomInstanceHasher.h" | 40 #include "../Core/DicomFormat/DicomInstanceHasher.h" |
40 #include "ServerEnumerations.h" | 41 #include "ServerEnumerations.h" |
41 | 42 |
53 | 54 |
54 class ServerIndex : public boost::noncopyable | 55 class ServerIndex : public boost::noncopyable |
55 { | 56 { |
56 private: | 57 private: |
57 class Transaction; | 58 class Transaction; |
59 struct UnstableResourcePayload; | |
58 | 60 |
61 bool done_; | |
59 boost::mutex mutex_; | 62 boost::mutex mutex_; |
60 boost::thread flushThread_; | 63 boost::thread flushThread_; |
64 boost::thread unstableResourcesMonitorThread_; | |
61 | 65 |
62 std::auto_ptr<Internals::ServerIndexListener> listener_; | 66 std::auto_ptr<Internals::ServerIndexListener> listener_; |
63 std::auto_ptr<DatabaseWrapper> db_; | 67 std::auto_ptr<DatabaseWrapper> db_; |
68 LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload> unstableResources_; | |
64 | 69 |
65 uint64_t currentStorageSize_; | 70 uint64_t currentStorageSize_; |
66 uint64_t maximumStorageSize_; | 71 uint64_t maximumStorageSize_; |
67 unsigned int maximumPatients_; | 72 unsigned int maximumPatients_; |
73 | |
74 static void FlushThread(ServerIndex* that); | |
75 | |
76 static void UnstableResourcesMonitorThread(ServerIndex* that); | |
68 | 77 |
69 void MainDicomTagsToJson(Json::Value& result, | 78 void MainDicomTagsToJson(Json::Value& result, |
70 int64_t resourceId); | 79 int64_t resourceId); |
71 | 80 |
72 SeriesStatus GetSeriesStatus(int id); | 81 SeriesStatus GetSeriesStatus(int id); |
75 | 84 |
76 void Recycle(uint64_t instanceSize, | 85 void Recycle(uint64_t instanceSize, |
77 const std::string& newPatientId); | 86 const std::string& newPatientId); |
78 | 87 |
79 void StandaloneRecycling(); | 88 void StandaloneRecycling(); |
89 | |
90 void MarkAsUnstable(int64_t id, | |
91 Orthanc::ResourceType type); | |
80 | 92 |
81 public: | 93 public: |
82 typedef std::list<FileInfo> Attachments; | 94 typedef std::list<FileInfo> Attachments; |
83 | 95 |
84 ServerIndex(ServerContext& context, | 96 ServerIndex(ServerContext& context, |
172 | 184 |
173 void DeleteExportedResources(); | 185 void DeleteExportedResources(); |
174 | 186 |
175 void GetStatistics(Json::Value& target, | 187 void GetStatistics(Json::Value& target, |
176 const std::string& publicId); | 188 const std::string& publicId); |
189 | |
190 void LookupTagValue(std::list<std::string>& result, | |
191 DicomTag tag, | |
192 const std::string& value); | |
193 | |
194 void LookupTagValue(std::list<std::string>& result, | |
195 const std::string& value); | |
177 }; | 196 }; |
178 } | 197 } |