comparison OrthancFramework/Sources/FileStorage/StorageAccessor.h @ 4792:434843934307 storage-cache

Added a StorageCache in the StorageAccessor
author Alain Mazy <am@osimis.io>
date Thu, 30 Sep 2021 12:14:19 +0200
parents d9473bd5ed43
children 7053502fbf97
comparison
equal deleted inserted replaced
4790:9754d5f2f38a 4792:434843934307
52 #include <stdint.h> 52 #include <stdint.h>
53 53
54 namespace Orthanc 54 namespace Orthanc
55 { 55 {
56 class MetricsRegistry; 56 class MetricsRegistry;
57 class StorageCache;
57 58
58 /** 59 /**
59 * This class handles the compression/decompression of the raw files 60 * This class handles the compression/decompression of the raw files
60 * contained in the storage area, and monitors timing metrics (if 61 * contained in the storage area, and monitors timing metrics (if
61 * enabled). 62 * enabled).
64 { 65 {
65 private: 66 private:
66 class MetricsTimer; 67 class MetricsTimer;
67 68
68 IStorageArea& area_; 69 IStorageArea& area_;
70 StorageCache& cache_;
69 MetricsRegistry* metrics_; 71 MetricsRegistry* metrics_;
70 72
71 #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1 73 #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
72 void SetupSender(BufferHttpSender& sender, 74 void SetupSender(BufferHttpSender& sender,
73 const FileInfo& info, 75 const FileInfo& info,
74 const std::string& mime); 76 const std::string& mime);
75 #endif 77 #endif
76 78
77 public: 79 public:
78 explicit StorageAccessor(IStorageArea& area); 80 explicit StorageAccessor(IStorageArea& area,
81 StorageCache& cache);
79 82
80 StorageAccessor(IStorageArea& area, 83 StorageAccessor(IStorageArea& area,
84 StorageCache& cache,
81 MetricsRegistry& metrics); 85 MetricsRegistry& metrics);
82 86
83 FileInfo Write(const void* data, 87 FileInfo Write(const void* data,
84 size_t size, 88 size_t size,
85 FileContentType type, 89 FileContentType type,
94 void Read(std::string& content, 98 void Read(std::string& content,
95 const FileInfo& info); 99 const FileInfo& info);
96 100
97 void ReadRaw(std::string& content, 101 void ReadRaw(std::string& content,
98 const FileInfo& info); 102 const FileInfo& info);
103
104 IMemoryBuffer* ReadStartRange(const std::string& fileUuid,
105 FileContentType fullFileContentType,
106 uint64_t end /* exclusive */,
107 FileContentType startFileContentType);
99 108
100 void Remove(const std::string& fileUuid, 109 void Remove(const std::string& fileUuid,
101 FileContentType type); 110 FileContentType type);
102 111
103 void Remove(const FileInfo& info); 112 void Remove(const FileInfo& info);