comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 3020:d207f6ac1f86 db-changes

tracking disk size by the database engine to ensure consistency across transactions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 15 Dec 2018 10:57:18 +0100
parents 8336204d95dc
children 039a9d262d64
comparison
equal deleted inserted replaced
3019:8336204d95dc 3020:d207f6ac1f86
263 currentDiskSize_ = 0; // Unused 263 currentDiskSize_ = 0; // Unused
264 } 264 }
265 else 265 else
266 { 266 {
267 // This is the case of database plugins using Orthanc SDK <= 1.5.2 267 // This is the case of database plugins using Orthanc SDK <= 1.5.2
268 LOG(WARNING) << "Consider upgrading your database index plugin for best performance"; 268 LOG(WARNING) << "Your database index plugin is not compatible with multiple Orthanc writers";
269 currentDiskSize_ = GetTotalCompressedSize(); 269 currentDiskSize_ = GetTotalCompressedSize();
270 } 270 }
271 271
272 transaction.Commit(0); 272 transaction.Commit(0);
273 } 273 }
1144 throw OrthancException(ErrorCode_DatabasePlugin, 1144 throw OrthancException(ErrorCode_DatabasePlugin,
1145 "Unhandled type of answer for custom index plugin: " + 1145 "Unhandled type of answer for custom index plugin: " +
1146 boost::lexical_cast<std::string>(answer.type)); 1146 boost::lexical_cast<std::string>(answer.type));
1147 } 1147 }
1148 } 1148 }
1149
1150
1151 bool OrthancPluginDatabase::IsDiskSizeAbove(uint64_t threshold)
1152 {
1153 if (fastGetTotalSize_)
1154 {
1155 return GetTotalCompressedSize() > threshold;
1156 }
1157 else
1158 {
1159 assert(GetTotalCompressedSize() == currentDiskSize_);
1160 return currentDiskSize_ > threshold;
1161 }
1162 }
1149 } 1163 }