comparison Google/GoogleStoragePlugin.cpp @ 79:16514270d9ca

fix
author Alain Mazy <am@osimis.io>
date Fri, 14 Oct 2022 16:22:26 +0200
parents d7295e8678d7
children b3787f4aa16a
comparison
equal deleted inserted replaced
78:d7295e8678d7 79:16514270d9ca
34 google::cloud::storage::Client mainClient_; // the client that is created at startup. Each thread should copy it when it needs it. (from the doc: Instances of this class created via copy-construction or copy-assignment share the underlying pool of connections. Access to these copies via multiple threads is guaranteed to work. Two threads operating on the same instance of this class is not guaranteed to work.) 34 google::cloud::storage::Client mainClient_; // the client that is created at startup. Each thread should copy it when it needs it. (from the doc: Instances of this class created via copy-construction or copy-assignment share the underlying pool of connections. Access to these copies via multiple threads is guaranteed to work. Two threads operating on the same instance of this class is not guaranteed to work.)
35 bool storageContainsUnknownFiles_; 35 bool storageContainsUnknownFiles_;
36 36
37 public: 37 public:
38 38
39 GoogleStoragePlugin(const std::string& bucketName, 39 GoogleStoragePlugin(const std::string& nameForLogs,
40 const std::string& bucketName,
40 google::cloud::storage::Client& mainClient, 41 google::cloud::storage::Client& mainClient,
41 bool enableLegacyStorageStructure, 42 bool enableLegacyStorageStructure,
42 bool storageContainsUnknownFiles 43 bool storageContainsUnknownFiles
43 ); 44 );
44 45
232 const char* GoogleStoragePluginFactory::GetStoragePluginName() 233 const char* GoogleStoragePluginFactory::GetStoragePluginName()
233 { 234 {
234 return "Google Cloud Storage"; 235 return "Google Cloud Storage";
235 } 236 }
236 237
237 IStorage* GoogleStoragePluginFactory::CreateStorage(const OrthancPlugins::OrthancConfiguration& orthancConfig) 238 IStorage* GoogleStoragePluginFactory::CreateStorage(const std::string& nameForLogs, const OrthancPlugins::OrthancConfiguration& orthancConfig)
238 { 239 {
239 bool enableLegacyStorageStructure; 240 bool enableLegacyStorageStructure;
240 bool storageContainsUnknownFiles; 241 bool storageContainsUnknownFiles;
241 242
242 if (!orthancConfig.IsSection(PLUGIN_SECTION)) 243 if (!orthancConfig.IsSection(PLUGIN_SECTION))
283 { 284 {
284 OrthancPlugins::LogError("GoogleCloudStorage plugin: unable to create client: " + mainClient.status().message()); 285 OrthancPlugins::LogError("GoogleCloudStorage plugin: unable to create client: " + mainClient.status().message());
285 return nullptr; 286 return nullptr;
286 } 287 }
287 288
288 return new GoogleStoragePlugin(googleBucketName, mainClient.value(), enableLegacyStorageStructure, storageContainsUnknownFiles); 289 return new GoogleStoragePlugin(nameForLogs, googleBucketName, mainClient.value(), enableLegacyStorageStructure, storageContainsUnknownFiles);
289 } 290 }
290 291
291 GoogleStoragePlugin::GoogleStoragePlugin(const std::string &bucketName, google::cloud::storage::Client& mainClient, bool enableLegacyStorageStructure, bool storageContainsUnknownFiles) 292 GoogleStoragePlugin::GoogleStoragePlugin(const std::string& nameForLogs, const std::string &bucketName, google::cloud::storage::Client& mainClient, bool enableLegacyStorageStructure, bool storageContainsUnknownFiles)
292 : BaseStorage(enableLegacyStorageStructure), 293 : BaseStorage(nameForLogs, enableLegacyStorageStructure),
293 bucketName_(bucketName), 294 bucketName_(bucketName),
294 mainClient_(mainClient), 295 mainClient_(mainClient),
295 storageContainsUnknownFiles_(storageContainsUnknownFiles) 296 storageContainsUnknownFiles_(storageContainsUnknownFiles)
296 { 297 {
297 298