Example #1
0
 public BackupStorageFactory(ConsumerBackupStorage consumerBackupStorage, LocalBackupStorage localBackupStorage, IConfiguration configuration, DocumentsBackupStorage documentsBackupStorage, TenantManager tenantManager, DataStoreBackupStorage dataStoreBackupStorage)
 {
     Configuration          = configuration;
     DocumentsBackupStorage = documentsBackupStorage;
     DataStoreBackupStorage = dataStoreBackupStorage;
     LocalBackupStorage     = localBackupStorage;
     ConsumerBackupStorage  = consumerBackupStorage;
     TenantManager          = tenantManager;
 }
 public BackupStorageFactory(
     ConsumerBackupStorage consumerBackupStorage,
     LocalBackupStorage localBackupStorage,
     ConfigurationExtension configuration,
     DocumentsBackupStorage documentsBackupStorage,
     TenantManager tenantManager,
     DataStoreBackupStorage dataStoreBackupStorage,
     IOptionsMonitor <ILog> options)
 {
     Configuration          = configuration;
     DocumentsBackupStorage = documentsBackupStorage;
     DataStoreBackupStorage = dataStoreBackupStorage;
     Log = options.CurrentValue;
     LocalBackupStorage    = localBackupStorage;
     ConsumerBackupStorage = consumerBackupStorage;
     TenantManager         = tenantManager;
 }
Example #3
0
        public IBackupStorage GetBackupStorage(BackupStorageType type, int tenantId, Dictionary <string, string> storageParams)
        {
            var settings      = Configuration.GetSetting <BackupSettings>("backup");
            var webConfigPath = PathHelper.ToRootedConfigPath(settings.WebConfigs.CurrentPath);


            switch (type)
            {
            case BackupStorageType.Documents:
            case BackupStorageType.ThridpartyDocuments:
            {
                DocumentsBackupStorage.Init(tenantId, webConfigPath);
                return(DocumentsBackupStorage);
            }

            case BackupStorageType.DataStore:
            {
                DataStoreBackupStorage.Init(tenantId, webConfigPath);
                return(DataStoreBackupStorage);
            }

            case BackupStorageType.Local:
                return(LocalBackupStorage);

            case BackupStorageType.ThirdPartyConsumer:
            {
                if (storageParams == null)
                {
                    return(null);
                }
                TenantManager.SetCurrentTenant(tenantId);
                ConsumerBackupStorage.Init(storageParams);
                return(ConsumerBackupStorage);
            }

            default:
                throw new InvalidOperationException("Unknown storage type.");
            }
        }