comparison 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
comparison
equal deleted inserted replaced
5549:dcbf0c776945 5553:28cc06e4859a
485 DatabasePluginMessages::TransactionResponse response; 485 DatabasePluginMessages::TransactionResponse response;
486 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_GET_CHANGES, request); 486 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_GET_CHANGES, request);
487 487
488 done = response.get_changes().done(); 488 done = response.get_changes().done();
489 489
490 target.clear();
491 for (int i = 0; i < response.get_changes().changes().size(); i++)
492 {
493 target.push_back(Convert(response.get_changes().changes(i)));
494 }
495 }
496
497 virtual void GetChanges2(std::list<ServerIndexChange>& target /*out*/,
498 bool& done /*out*/,
499 int64_t since,
500 int64_t to,
501 uint32_t limit,
502 ChangeType changeType) ORTHANC_OVERRIDE
503 {
504 assert(database_.GetDatabaseCapabilities().HasExtendedApiV1());
505
506 DatabasePluginMessages::TransactionRequest request;
507 DatabasePluginMessages::TransactionResponse response;
508
509 request.mutable_get_changes2()->set_since(since);
510 request.mutable_get_changes2()->set_limit(limit);
511 request.mutable_get_changes2()->set_to(to);
512 request.mutable_get_changes2()->set_change_type(changeType);
513 ExecuteTransaction(response, DatabasePluginMessages::OPERATION_GET_CHANGES_2, request);
514
515 done = response.get_changes().done();
516
490 target.clear(); 517 target.clear();
491 for (int i = 0; i < response.get_changes().changes().size(); i++) 518 for (int i = 0; i < response.get_changes().changes().size(); i++)
492 { 519 {
493 target.push_back(Convert(response.get_changes().changes(i))); 520 target.push_back(Convert(response.get_changes().changes(i)));
494 } 521 }
1361 dbCapabilities_.SetRevisionsSupport(systemInfo.supports_revisions()); 1388 dbCapabilities_.SetRevisionsSupport(systemInfo.supports_revisions());
1362 dbCapabilities_.SetLabelsSupport(systemInfo.supports_labels()); 1389 dbCapabilities_.SetLabelsSupport(systemInfo.supports_labels());
1363 dbCapabilities_.SetAtomicIncrementGlobalProperty(systemInfo.supports_increment_global_property()); 1390 dbCapabilities_.SetAtomicIncrementGlobalProperty(systemInfo.supports_increment_global_property());
1364 dbCapabilities_.SetUpdateAndGetStatistics(systemInfo.has_update_and_get_statistics()); 1391 dbCapabilities_.SetUpdateAndGetStatistics(systemInfo.has_update_and_get_statistics());
1365 dbCapabilities_.SetMeasureLatency(systemInfo.has_measure_latency()); 1392 dbCapabilities_.SetMeasureLatency(systemInfo.has_measure_latency());
1393 dbCapabilities_.SetHasExtendedApiV1(systemInfo.has_extended_api_v1());
1366 } 1394 }
1367 1395
1368 open_ = true; 1396 open_ = true;
1369 } 1397 }
1370 1398