diff OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp @ 5553:28cc06e4859a large-queries

Added ExtendedApiV1: /changes
author Alain Mazy <am@orthanc.team>
date Thu, 11 Apr 2024 19:02:20 +0200
parents d7c24c9c9448
children 3765085693e5
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Fri Mar 29 23:23:01 2024 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Thu Apr 11 19:02:20 2024 +0200
@@ -494,6 +494,33 @@
       }
     }
 
+    virtual void GetChanges2(std::list<ServerIndexChange>& target /*out*/,
+                             bool& done /*out*/,
+                             int64_t since,
+                             int64_t to,
+                             uint32_t limit,
+                             ChangeType changeType) ORTHANC_OVERRIDE
+    {
+      assert(database_.GetDatabaseCapabilities().HasExtendedApiV1());
+
+      DatabasePluginMessages::TransactionRequest request;
+      DatabasePluginMessages::TransactionResponse response;
+
+      request.mutable_get_changes2()->set_since(since);
+      request.mutable_get_changes2()->set_limit(limit);
+      request.mutable_get_changes2()->set_to(to);
+      request.mutable_get_changes2()->set_change_type(changeType);
+      ExecuteTransaction(response, DatabasePluginMessages::OPERATION_GET_CHANGES_2, request);
+
+      done = response.get_changes().done();
+
+      target.clear();
+      for (int i = 0; i < response.get_changes().changes().size(); i++)
+      {
+        target.push_back(Convert(response.get_changes().changes(i)));
+      }
+    }
+
     
     virtual void GetChildrenInternalId(std::list<int64_t>& target,
                                        int64_t id) ORTHANC_OVERRIDE
@@ -1363,6 +1390,7 @@
       dbCapabilities_.SetAtomicIncrementGlobalProperty(systemInfo.supports_increment_global_property());
       dbCapabilities_.SetUpdateAndGetStatistics(systemInfo.has_update_and_get_statistics());
       dbCapabilities_.SetMeasureLatency(systemInfo.has_measure_latency());
+      dbCapabilities_.SetHasExtendedApiV1(systemInfo.has_extended_api_v1());
     }
 
     open_ = true;