comparison Framework/Plugins/DatabaseBackendAdapterV4.cpp @ 431:7c1fe5d6c12c pg-transactions

PG: IncrementGlobalProperty
author Alain Mazy <am@osimis.io>
date Thu, 07 Dec 2023 12:13:43 +0100
parents 91124cc8a8c7
children f16faa1fdc46
comparison
equal deleted inserted replaced
430:f1f3c5554283 431:7c1fe5d6c12c
429 IndexConnectionsPool::Accessor accessor(pool); 429 IndexConnectionsPool::Accessor accessor(pool);
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 break; 435 break;
435 } 436 }
436 437
437 case Orthanc::DatabasePluginMessages::OPERATION_OPEN: 438 case Orthanc::DatabasePluginMessages::OPERATION_OPEN:
438 { 439 {
939 response.mutable_lookup_global_property()->set_found(false); 940 response.mutable_lookup_global_property()->set_found(false);
940 } 941 }
941 942
942 break; 943 break;
943 } 944 }
944 945
946 case Orthanc::DatabasePluginMessages::OPERATION_INCREMENT_GLOBAL_PROPERTY:
947 {
948 int64_t value = backend.IncrementGlobalProperty(manager, request.increment_global_property().server_id().c_str(),
949 request.increment_global_property().property(),
950 request.increment_global_property().increment());
951 response.mutable_increment_global_property()->set_new_value(value);
952 break;
953 }
954
945 case Orthanc::DatabasePluginMessages::OPERATION_LOOKUP_METADATA: 955 case Orthanc::DatabasePluginMessages::OPERATION_LOOKUP_METADATA:
946 { 956 {
947 std::string value; 957 std::string value;
948 int64_t revision = -1; 958 int64_t revision = -1;
949 if (backend.LookupMetadata(value, revision, manager, request.lookup_metadata().id(), request.lookup_metadata().metadata_type())) 959 if (backend.LookupMetadata(value, revision, manager, request.lookup_metadata().id(), request.lookup_metadata().metadata_type()))