comparison Framework/Plugins/DatabaseBackendAdapterV4.cpp @ 436:f16faa1fdc46 pg-transactions

InsertOrUpdateMetadata function + UpdateAndGetStatistics
author Alain Mazy <am@osimis.io>
date Fri, 15 Dec 2023 17:11:26 +0100
parents 7c1fe5d6c12c
children cec6a0cd399f
comparison
equal deleted inserted replaced
435:326f8304daa1 436:f16faa1fdc46
430 response.mutable_get_system_information()->set_database_version(accessor.GetBackend().GetDatabaseVersion(accessor.GetManager())); 430 response.mutable_get_system_information()->set_database_version(accessor.GetBackend().GetDatabaseVersion(accessor.GetManager()));
431 response.mutable_get_system_information()->set_supports_flush_to_disk(false); 431 response.mutable_get_system_information()->set_supports_flush_to_disk(false);
432 response.mutable_get_system_information()->set_supports_revisions(accessor.GetBackend().HasRevisionsSupport()); 432 response.mutable_get_system_information()->set_supports_revisions(accessor.GetBackend().HasRevisionsSupport());
433 response.mutable_get_system_information()->set_supports_labels(accessor.GetBackend().HasLabelsSupport()); 433 response.mutable_get_system_information()->set_supports_labels(accessor.GetBackend().HasLabelsSupport());
434 response.mutable_get_system_information()->set_supports_increment_global_property(accessor.GetBackend().HasAtomicIncrementGlobalProperty()); 434 response.mutable_get_system_information()->set_supports_increment_global_property(accessor.GetBackend().HasAtomicIncrementGlobalProperty());
435 response.mutable_get_system_information()->set_has_update_and_get_statistics(accessor.GetBackend().HasUpdateAndGetStatistics());
435 break; 436 break;
436 } 437 }
437 438
438 case Orthanc::DatabasePluginMessages::OPERATION_OPEN: 439 case Orthanc::DatabasePluginMessages::OPERATION_OPEN:
439 { 440 {
941 } 942 }
942 943
943 break; 944 break;
944 } 945 }
945 946
947 case Orthanc::DatabasePluginMessages::OPERATION_UPDATE_AND_GET_STATISTICS:
948 {
949 int64_t patientsCount, studiesCount, seriesCount, instancesCount, compressedSize, uncompressedSize;
950 backend.UpdateAndGetStatistics(manager, patientsCount, studiesCount, seriesCount, instancesCount, compressedSize, uncompressedSize);
951
952 response.mutable_update_and_get_statistics()->set_patients_count(patientsCount);
953 response.mutable_update_and_get_statistics()->set_studies_count(studiesCount);
954 response.mutable_update_and_get_statistics()->set_series_count(seriesCount);
955 response.mutable_update_and_get_statistics()->set_instances_count(instancesCount);
956 response.mutable_update_and_get_statistics()->set_total_compressed_size(compressedSize);
957 response.mutable_update_and_get_statistics()->set_total_uncompressed_size(uncompressedSize);
958 break;
959 }
960
946 case Orthanc::DatabasePluginMessages::OPERATION_INCREMENT_GLOBAL_PROPERTY: 961 case Orthanc::DatabasePluginMessages::OPERATION_INCREMENT_GLOBAL_PROPERTY:
947 { 962 {
948 int64_t value = backend.IncrementGlobalProperty(manager, request.increment_global_property().server_id().c_str(), 963 int64_t value = backend.IncrementGlobalProperty(manager, request.increment_global_property().server_id().c_str(),
949 request.increment_global_property().property(), 964 request.increment_global_property().property(),
950 request.increment_global_property().increment()); 965 request.increment_global_property().increment());