Mercurial > hg > orthanc-object-storage
comparison Azure/AzureBlobStoragePlugin.cpp @ 78:d7295e8678d7
renames
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 14 Oct 2022 11:00:18 +0200 |
parents | a2bb9acdc5e6 |
children | 16514270d9ca |
comparison
equal
deleted
inserted
replaced
77:80792bb9600e | 78:d7295e8678d7 |
---|---|
29 | 29 |
30 // Create aliases to make the code easier to read. | 30 // Create aliases to make the code easier to read. |
31 namespace as = azure::storage; | 31 namespace as = azure::storage; |
32 static const char* const PLUGIN_SECTION = "AzureBlobStorage"; | 32 static const char* const PLUGIN_SECTION = "AzureBlobStorage"; |
33 | 33 |
34 class AzureBlobStoragePlugin : public BaseStoragePlugin | 34 class AzureBlobStoragePlugin : public BaseStorage |
35 { | 35 { |
36 public: | 36 public: |
37 | 37 |
38 as::cloud_blob_client blobClient_; | 38 as::cloud_blob_client blobClient_; |
39 as::cloud_blob_container blobContainer_; | 39 as::cloud_blob_container blobContainer_; |
52 virtual void DeleteObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled); | 52 virtual void DeleteObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled); |
53 virtual const char* GetConfigurationSectionName() {return PLUGIN_SECTION;}; | 53 virtual const char* GetConfigurationSectionName() {return PLUGIN_SECTION;}; |
54 }; | 54 }; |
55 | 55 |
56 | 56 |
57 class Writer : public IStoragePlugin::IWriter | 57 class Writer : public IStorage::IWriter |
58 { | 58 { |
59 std::string path_; | 59 std::string path_; |
60 as::cloud_blob_client client_; | 60 as::cloud_blob_client client_; |
61 as::cloud_blob_container container_; | 61 as::cloud_blob_container container_; |
62 | 62 |
87 } | 87 } |
88 } | 88 } |
89 }; | 89 }; |
90 | 90 |
91 | 91 |
92 class Reader : public IStoragePlugin::IReader | 92 class Reader : public IStorage::IReader |
93 { | 93 { |
94 std::string path_; | 94 std::string path_; |
95 as::cloud_blob_client client_; | 95 as::cloud_blob_client client_; |
96 as::cloud_blob_container container_; | 96 as::cloud_blob_container container_; |
97 as::cloud_block_blob block_; | 97 as::cloud_block_blob block_; |
194 } | 194 } |
195 | 195 |
196 return false; | 196 return false; |
197 } | 197 } |
198 | 198 |
199 IStoragePlugin* AzureBlobStoragePluginFactory::CreateStoragePlugin(const OrthancPlugins::OrthancConfiguration& orthancConfig) | 199 IStorage* AzureBlobStoragePluginFactory::CreateStorage(const OrthancPlugins::OrthancConfiguration& orthancConfig) |
200 { | 200 { |
201 std::string connectionString; | 201 std::string connectionString; |
202 std::string containerName; | 202 std::string containerName; |
203 bool enableLegacyStorageStructure; | 203 bool enableLegacyStorageStructure; |
204 bool storageContainsUnknownFiles; | 204 bool storageContainsUnknownFiles; |
207 if (orthancConfig.IsSection(PLUGIN_SECTION)) | 207 if (orthancConfig.IsSection(PLUGIN_SECTION)) |
208 { | 208 { |
209 OrthancPlugins::OrthancConfiguration pluginSection; | 209 OrthancPlugins::OrthancConfiguration pluginSection; |
210 orthancConfig.GetSection(pluginSection, PLUGIN_SECTION); | 210 orthancConfig.GetSection(pluginSection, PLUGIN_SECTION); |
211 | 211 |
212 if (!BaseStoragePlugin::ReadCommonConfiguration(enableLegacyStorageStructure, storageContainsUnknownFiles, pluginSection)) | 212 if (!BaseStorage::ReadCommonConfiguration(enableLegacyStorageStructure, storageContainsUnknownFiles, pluginSection)) |
213 { | 213 { |
214 return nullptr; | 214 return nullptr; |
215 } | 215 } |
216 | 216 |
217 if (!pluginSection.LookupStringValue(connectionString, "ConnectionString")) | 217 if (!pluginSection.LookupStringValue(connectionString, "ConnectionString")) |
312 } | 312 } |
313 | 313 |
314 } | 314 } |
315 | 315 |
316 AzureBlobStoragePlugin::AzureBlobStoragePlugin(const as::cloud_blob_client& blobClient, const as::cloud_blob_container& blobContainer, bool enableLegacyStorageStructure, bool storageContainsUnknownFiles) | 316 AzureBlobStoragePlugin::AzureBlobStoragePlugin(const as::cloud_blob_client& blobClient, const as::cloud_blob_container& blobContainer, bool enableLegacyStorageStructure, bool storageContainsUnknownFiles) |
317 : BaseStoragePlugin(enableLegacyStorageStructure), | 317 : BaseStorage(enableLegacyStorageStructure), |
318 blobClient_(blobClient), | 318 blobClient_(blobClient), |
319 blobContainer_(blobContainer), | 319 blobContainer_(blobContainer), |
320 storageContainsUnknownFiles_(storageContainsUnknownFiles) | 320 storageContainsUnknownFiles_(storageContainsUnknownFiles) |
321 { | 321 { |
322 | 322 |
323 } | 323 } |
324 | 324 |
325 IStoragePlugin::IWriter* AzureBlobStoragePlugin::GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) | 325 IStorage::IWriter* AzureBlobStoragePlugin::GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) |
326 { | 326 { |
327 return new Writer(blobContainer_, GetPath(uuid, type, encryptionEnabled), blobClient_); | 327 return new Writer(blobContainer_, GetPath(uuid, type, encryptionEnabled), blobClient_); |
328 } | 328 } |
329 | 329 |
330 IStoragePlugin::IReader* AzureBlobStoragePlugin::GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) | 330 IStorage::IReader* AzureBlobStoragePlugin::GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) |
331 { | 331 { |
332 std::list<std::string> paths; | 332 std::list<std::string> paths; |
333 paths.push_back(GetPath(uuid, type, encryptionEnabled, false)); | 333 paths.push_back(GetPath(uuid, type, encryptionEnabled, false)); |
334 if (storageContainsUnknownFiles_) | 334 if (storageContainsUnknownFiles_) |
335 { | 335 { |