comparison OrthancServer/ServerIndex.h @ 1247:32fcc5dc7562

abstraction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Dec 2014 13:54:27 +0100
parents 6c07108ff1e2
children 40725595aaf0
comparison
equal deleted inserted replaced
1246:54bf0f0245f4 1247:32fcc5dc7562
38 #include "../Core/SQLite/Connection.h" 38 #include "../Core/SQLite/Connection.h"
39 #include "../Core/DicomFormat/DicomMap.h" 39 #include "../Core/DicomFormat/DicomMap.h"
40 #include "../Core/DicomFormat/DicomInstanceHasher.h" 40 #include "../Core/DicomFormat/DicomInstanceHasher.h"
41 #include "ServerEnumerations.h" 41 #include "ServerEnumerations.h"
42 42
43 #include "DatabaseWrapper.h" 43 #include "IDatabaseWrapper.h"
44 44
45 45
46 namespace Orthanc 46 namespace Orthanc
47 { 47 {
48 class ServerContext; 48 class ServerContext;
66 boost::mutex mutex_; 66 boost::mutex mutex_;
67 boost::thread flushThread_; 67 boost::thread flushThread_;
68 boost::thread unstableResourcesMonitorThread_; 68 boost::thread unstableResourcesMonitorThread_;
69 69
70 std::auto_ptr<Internals::ServerIndexListener> listener_; 70 std::auto_ptr<Internals::ServerIndexListener> listener_;
71 std::auto_ptr<DatabaseWrapper> db_; 71 IDatabaseWrapper& db_;
72 LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload> unstableResources_; 72 LeastRecentlyUsedIndex<int64_t, UnstableResourcePayload> unstableResources_;
73 73
74 uint64_t currentStorageSize_; 74 uint64_t currentStorageSize_;
75 uint64_t maximumStorageSize_; 75 uint64_t maximumStorageSize_;
76 unsigned int maximumPatients_; 76 unsigned int maximumPatients_;
111 ChangeType changeType, 111 ChangeType changeType,
112 ResourceType resourceType, 112 ResourceType resourceType,
113 const std::string& publicId) 113 const std::string& publicId)
114 { 114 {
115 ServerIndexChange change(changeType, resourceType, publicId); 115 ServerIndexChange change(changeType, resourceType, publicId);
116 db_->LogChange(internalId, change); 116 db_.LogChange(internalId, change);
117 } 117 }
118 118
119 uint64_t IncrementGlobalSequenceInternal(GlobalProperty property); 119 uint64_t IncrementGlobalSequenceInternal(GlobalProperty property);
120 120
121 121
122 public: 122 public:
123 ServerIndex(ServerContext& context, 123 ServerIndex(ServerContext& context,
124 const std::string& dbPath); 124 IDatabaseWrapper& database);
125 125
126 ~ServerIndex(); 126 ~ServerIndex();
127 127
128 uint64_t GetMaximumStorageSize() const 128 uint64_t GetMaximumStorageSize() const
129 { 129 {
162 162
163 bool DeleteResource(Json::Value& target /* out */, 163 bool DeleteResource(Json::Value& target /* out */,
164 const std::string& uuid, 164 const std::string& uuid,
165 ResourceType expectedType); 165 ResourceType expectedType);
166 166
167 bool GetChanges(Json::Value& target, 167 void GetChanges(Json::Value& target,
168 int64_t since, 168 int64_t since,
169 unsigned int maxResults); 169 unsigned int maxResults);
170 170
171 bool GetLastChange(Json::Value& target); 171 void GetLastChange(Json::Value& target);
172 172
173 void LogExportedResource(const std::string& publicId, 173 void LogExportedResource(const std::string& publicId,
174 const std::string& remoteModality); 174 const std::string& remoteModality);
175 175
176 bool GetExportedResources(Json::Value& target, 176 void GetExportedResources(Json::Value& target,
177 int64_t since, 177 int64_t since,
178 unsigned int maxResults); 178 unsigned int maxResults);
179 179
180 bool GetLastExportedResource(Json::Value& target); 180 void GetLastExportedResource(Json::Value& target);
181 181
182 bool IsProtectedPatient(const std::string& publicId); 182 bool IsProtectedPatient(const std::string& publicId);
183 183
184 void SetProtectedPatient(const std::string& publicId, 184 void SetProtectedPatient(const std::string& publicId,
185 bool isProtected); 185 bool isProtected);