comparison OrthancServer/Sources/Database/IDatabaseWrapper.h @ 5758:ca06dde85358 large-queries

merged find-refactoring -> large-queries
author Alain Mazy <am@orthanc.team>
date Thu, 05 Sep 2024 18:52:27 +0200
parents 5463c3ae3235 95a3802ad133
children
comparison
equal deleted inserted replaced
5757:5463c3ae3235 5758:ca06dde85358
27 #include "../../../OrthancFramework/Sources/FileStorage/FileInfo.h" 27 #include "../../../OrthancFramework/Sources/FileStorage/FileInfo.h"
28 #include "../../../OrthancFramework/Sources/FileStorage/IStorageArea.h" 28 #include "../../../OrthancFramework/Sources/FileStorage/IStorageArea.h"
29 #include "../ExportedResource.h" 29 #include "../ExportedResource.h"
30 #include "../Search/ISqlLookupFormatter.h" 30 #include "../Search/ISqlLookupFormatter.h"
31 #include "../ServerIndexChange.h" 31 #include "../ServerIndexChange.h"
32 #include "FindRequest.h"
33 #include "FindResponse.h"
32 #include "IDatabaseListener.h" 34 #include "IDatabaseListener.h"
33 35
34 #include <list> 36 #include <list>
35 #include <boost/noncopyable.hpp> 37 #include <boost/noncopyable.hpp>
36 #include <set> 38 #include <set>
37 39
38 namespace Orthanc 40 namespace Orthanc
39 { 41 {
40 class DatabaseConstraint; 42 class DatabaseConstraints;
41 class ResourcesContent; 43 class ResourcesContent;
42 44
43 class IDatabaseWrapper : public boost::noncopyable 45 class IDatabaseWrapper : public boost::noncopyable
44 { 46 {
45 public: 47 public:
50 bool hasRevisionsSupport_; 52 bool hasRevisionsSupport_;
51 bool hasLabelsSupport_; 53 bool hasLabelsSupport_;
52 bool hasAtomicIncrementGlobalProperty_; 54 bool hasAtomicIncrementGlobalProperty_;
53 bool hasUpdateAndGetStatistics_; 55 bool hasUpdateAndGetStatistics_;
54 bool hasMeasureLatency_; 56 bool hasMeasureLatency_;
57 bool hasFindSupport_;
55 bool hasExtendedChanges_; 58 bool hasExtendedChanges_;
56 59
57 public: 60 public:
58 Capabilities() : 61 Capabilities() :
59 hasFlushToDisk_(false), 62 hasFlushToDisk_(false),
60 hasRevisionsSupport_(false), 63 hasRevisionsSupport_(false),
61 hasLabelsSupport_(false), 64 hasLabelsSupport_(false),
62 hasAtomicIncrementGlobalProperty_(false), 65 hasAtomicIncrementGlobalProperty_(false),
63 hasUpdateAndGetStatistics_(false), 66 hasUpdateAndGetStatistics_(false),
64 hasMeasureLatency_(false), 67 hasMeasureLatency_(false),
68 hasFindSupport_(false),
65 hasExtendedChanges_(false) 69 hasExtendedChanges_(false)
66 { 70 {
67 } 71 }
68 72
69 void SetFlushToDisk(bool value) 73 void SetFlushToDisk(bool value)
132 } 136 }
133 137
134 bool HasMeasureLatency() const 138 bool HasMeasureLatency() const
135 { 139 {
136 return hasMeasureLatency_; 140 return hasMeasureLatency_;
141 }
142
143 void SetHasFindSupport(bool value)
144 {
145 hasFindSupport_ = value;
146 }
147
148 bool HasFindSupport() const
149 {
150 return hasFindSupport_;
137 } 151 }
138 }; 152 };
139 153
140 154
141 struct CreateInstanceResult : public boost::noncopyable 155 struct CreateInstanceResult : public boost::noncopyable
292 306
293 virtual bool IsDiskSizeAbove(uint64_t threshold) = 0; 307 virtual bool IsDiskSizeAbove(uint64_t threshold) = 0;
294 308
295 virtual void ApplyLookupResources(std::list<std::string>& resourcesId, 309 virtual void ApplyLookupResources(std::list<std::string>& resourcesId,
296 std::list<std::string>* instancesId, // Can be NULL if not needed 310 std::list<std::string>* instancesId, // Can be NULL if not needed
297 const std::vector<DatabaseConstraint>& lookup, 311 const DatabaseConstraints& lookup,
298 ResourceType queryLevel, 312 ResourceType queryLevel,
299 const std::set<std::string>& labels, 313 const std::set<std::string>& labels,
300 LabelsConstraint labelsConstraint, 314 LabelsConstraint labelsConstraint,
301 uint32_t limit) = 0; 315 uint32_t limit) = 0;
302 316
363 int64_t& seriesCount, 377 int64_t& seriesCount,
364 int64_t& instancesCount, 378 int64_t& instancesCount,
365 int64_t& compressedSize, 379 int64_t& compressedSize,
366 int64_t& uncompressedSize) = 0; 380 int64_t& uncompressedSize) = 0;
367 381
368 // New in Orthanc 1.13.0 382 /**
383 * Primitives introduced in Orthanc 1.12.4
384 **/
385
386 // This is only implemented if "HasIntegratedFind()" is "true"
387 virtual void ExecuteFind(FindResponse& response,
388 const FindRequest& request,
389 const Capabilities& capabilities) = 0;
390
391 // This is only implemented if "HasIntegratedFind()" is "false"
392 virtual void ExecuteFind(std::list<std::string>& identifiers,
393 const Capabilities& capabilities,
394 const FindRequest& request) = 0;
395
396 /**
397 * This is only implemented if "HasIntegratedFind()" is
398 * "false". In this flavor, the resource of interest might have
399 * been deleted, as the expansion is not done in the same
400 * transaction as the "ExecuteFind()". In such cases, the
401 * wrapper should not throw an exception, but simply ignore the
402 * request to expand the resource (i.e., "response" must not be
403 * modified).
404 **/
405 virtual void ExecuteExpand(FindResponse& response,
406 const Capabilities& capabilities,
407 const FindRequest& request,
408 const std::string& identifier) = 0;
409
410 // New in Orthanc 1.12.5
369 virtual void GetChangesExtended(std::list<ServerIndexChange>& target /*out*/, 411 virtual void GetChangesExtended(std::list<ServerIndexChange>& target /*out*/,
370 bool& done /*out*/, 412 bool& done /*out*/,
371 int64_t since, 413 int64_t since,
372 int64_t to, 414 int64_t to,
373 uint32_t limit, 415 uint32_t limit,
374 ChangeType filterType) = 0; 416 ChangeType filterType) = 0;
375
376 }; 417 };
377 418
378 419
379 virtual ~IDatabaseWrapper() 420 virtual ~IDatabaseWrapper()
380 { 421 {
395 IStorageArea& storageArea) = 0; 436 IStorageArea& storageArea) = 0;
396 437
397 virtual const Capabilities GetDatabaseCapabilities() const = 0; 438 virtual const Capabilities GetDatabaseCapabilities() const = 0;
398 439
399 virtual uint64_t MeasureLatency() = 0; 440 virtual uint64_t MeasureLatency() = 0;
441
442 // Returns "true" iff. the database engine supports the
443 // simultaneous find and expansion of resources.
444 virtual bool HasIntegratedFind() const = 0;
400 }; 445 };
401 } 446 }