Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp @ 5466:dceed5e3d6a9 pg-transactions
new DB plugin primitive: UpdateAndGetStatistics
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 15 Dec 2023 17:15:43 +0100 |
parents | 176bc05f85f4 |
children | b3ebe249ed5b |
comparison
equal
deleted
inserted
replaced
5465:2829889bfa57 | 5466:dceed5e3d6a9 |
---|---|
789 DatabasePluginMessages::TransactionResponse response; | 789 DatabasePluginMessages::TransactionResponse response; |
790 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_INCREMENT_GLOBAL_PROPERTY, request); | 790 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_INCREMENT_GLOBAL_PROPERTY, request); |
791 | 791 |
792 return response.increment_global_property().new_value(); | 792 return response.increment_global_property().new_value(); |
793 } | 793 } |
794 | 794 |
795 virtual void UpdateAndGetStatistics(int64_t& patientsCount, | |
796 int64_t& studiesCount, | |
797 int64_t& seriesCount, | |
798 int64_t& instancesCount, | |
799 int64_t& compressedSize, | |
800 int64_t& uncompressedSize) ORTHANC_OVERRIDE | |
801 { | |
802 DatabasePluginMessages::TransactionResponse response; | |
803 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_UPDATE_AND_GET_STATISTICS); | |
804 | |
805 patientsCount = response.update_and_get_statistics().patients_count(); | |
806 studiesCount = response.update_and_get_statistics().studies_count(); | |
807 seriesCount = response.update_and_get_statistics().series_count(); | |
808 instancesCount = response.update_and_get_statistics().instances_count(); | |
809 compressedSize = response.update_and_get_statistics().total_compressed_size(); | |
810 uncompressedSize = response.update_and_get_statistics().total_uncompressed_size(); | |
811 } | |
812 | |
795 virtual bool LookupMetadata(std::string& target, | 813 virtual bool LookupMetadata(std::string& target, |
796 int64_t& revision, | 814 int64_t& revision, |
797 int64_t id, | 815 int64_t id, |
798 MetadataType type) ORTHANC_OVERRIDE | 816 MetadataType type) ORTHANC_OVERRIDE |
799 { | 817 { |
1273 errorDictionary_(errorDictionary), | 1291 errorDictionary_(errorDictionary), |
1274 definition_(database), | 1292 definition_(database), |
1275 serverIdentifier_(serverIdentifier), | 1293 serverIdentifier_(serverIdentifier), |
1276 open_(false), | 1294 open_(false), |
1277 databaseVersion_(0), | 1295 databaseVersion_(0), |
1278 dbCapabilities_(false, false, false, false) // updated in Open() | 1296 dbCapabilities_(false, false, false, false, false) // updated in Open() |
1279 { | 1297 { |
1280 CLOG(INFO, PLUGINS) << "Identifier of this Orthanc server for the global properties " | 1298 CLOG(INFO, PLUGINS) << "Identifier of this Orthanc server for the global properties " |
1281 << "of the custom database: \"" << serverIdentifier << "\""; | 1299 << "of the custom database: \"" << serverIdentifier << "\""; |
1282 | 1300 |
1283 if (definition_.backend == NULL || | 1301 if (definition_.backend == NULL || |
1347 databaseVersion_ = systemInfo.database_version(); | 1365 databaseVersion_ = systemInfo.database_version(); |
1348 dbCapabilities_.hasFlushToDisk_ = systemInfo.supports_flush_to_disk(); | 1366 dbCapabilities_.hasFlushToDisk_ = systemInfo.supports_flush_to_disk(); |
1349 dbCapabilities_.hasRevisionsSupport_ = systemInfo.supports_revisions(); | 1367 dbCapabilities_.hasRevisionsSupport_ = systemInfo.supports_revisions(); |
1350 dbCapabilities_.hasLabelsSupport_ = systemInfo.supports_labels(); | 1368 dbCapabilities_.hasLabelsSupport_ = systemInfo.supports_labels(); |
1351 dbCapabilities_.hasAtomicIncrementGlobalProperty_ = systemInfo.supports_increment_global_property(); | 1369 dbCapabilities_.hasAtomicIncrementGlobalProperty_ = systemInfo.supports_increment_global_property(); |
1370 dbCapabilities_.hasUpdateAndGetStatistics_ = systemInfo.has_update_and_get_statistics(); | |
1352 } | 1371 } |
1353 | 1372 |
1354 open_ = true; | 1373 open_ = true; |
1355 } | 1374 } |
1356 | 1375 |