Exemplo n.º 1
0
        /// <summary>
        /// Configure the database bundles if no changes has accord or when server start
        /// </summary>
        public void InitializeBundles()
        {
            DocumentsOperationContext context;

            using (_database.DocumentsStorage.ContextPool.AllocateOperationContext(out context))
            {
                context.OpenReadTransaction();
                var versioningConfiguration = _database.DocumentsStorage.Get(context,
                                                                             Constants.Versioning.RavenVersioningConfiguration);
                if (versioningConfiguration != null)
                {
                    VersioningStorage = VersioningStorage.LoadConfigurations(_database);
                    if (_logger.IsInfoEnabled)
                    {
                        _logger.Info("Versioning configuration enabled");
                    }
                }

                var expirationConfiguration = _database.DocumentsStorage.Get(context,
                                                                             Constants.Expiration.ConfigurationDocumentKey);
                if (expirationConfiguration != null)
                {
                    ExpiredDocumentsCleaner?.Dispose();
                    ExpiredDocumentsCleaner = ExpiredDocumentsCleaner.LoadConfigurations(_database);
                    if (_logger.IsInfoEnabled)
                    {
                        _logger.Info("Expiration configuration enabled");
                    }
                }

                var periodicExportConfiguration = _database.DocumentsStorage.Get(context,
                                                                                 Constants.PeriodicExport.ConfigurationDocumentKey);
                if (periodicExportConfiguration != null)
                {
                    PeriodicExportRunner?.Dispose();
                    PeriodicExportRunner = PeriodicExportRunner.LoadConfigurations(_database);
                    if (_logger.IsInfoEnabled)
                    {
                        _logger.Info("PeriodicExport configuration enabled");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void InitializeFromDatabaseRecord(DatabaseRecord record)
        {
            if (record == null)
            {
                return;
            }

            ClientConfiguration = record.Client;
            DocumentsStorage.RevisionsStorage.InitializeFromDatabaseRecord(record);
            ExpiredDocumentsCleaner = ExpiredDocumentsCleaner.LoadConfigurations(this, record, ExpiredDocumentsCleaner);
            PeriodicBackupRunner.UpdateConfigurations(record);
        }