public void ValidateLicense() { if (configuration.IsTenantDatabase) return; validateLicense = new ValidateLicense(); validateLicense.Execute(configuration); }
public DocumentDatabase(InMemoryRavenConfiguration configuration, TransportState transportState = null) { DocumentLock = new PutSerialLock(); this.configuration = configuration; this.transportState = transportState ?? new TransportState(); using (LogManager.OpenMappedContext("database", configuration.DatabaseName ?? Constants.SystemDatabase)) { log.Debug("Start loading the following database: {0}", configuration.DatabaseName ?? Constants.SystemDatabase); if (configuration.IsTenantDatabase == false) { validateLicense = new ValidateLicense(); validateLicense.Execute(configuration); } AppDomain.CurrentDomain.DomainUnload += DomainUnloadOrProcessExit; AppDomain.CurrentDomain.ProcessExit += DomainUnloadOrProcessExit; Name = configuration.DatabaseName; backgroundTaskScheduler = configuration.CustomTaskScheduler ?? TaskScheduler.Default; ExtensionsState = new AtomicDictionary<object>(); Configuration = configuration; ExecuteAlterConfiguration(); recentTouches = new SizeLimitedConcurrentDictionary<string, TouchedDocumentInfo>(configuration.MaxRecentTouchesToRemember, StringComparer.OrdinalIgnoreCase); configuration.Container.SatisfyImportsOnce(this); workContext = new WorkContext { Database = this, DatabaseName = Name, IndexUpdateTriggers = IndexUpdateTriggers, ReadTriggers = ReadTriggers, RaiseIndexChangeNotification = RaiseNotifications, TaskScheduler = backgroundTaskScheduler, Configuration = configuration, IndexReaderWarmers = IndexReaderWarmers }; TransactionalStorage = configuration.CreateTransactionalStorage(workContext.HandleWorkNotifications); try { sequentialUuidGenerator = new SequentialUuidGenerator(); TransactionalStorage.Initialize(sequentialUuidGenerator, DocumentCodecs); } catch (Exception) { TransactionalStorage.Dispose(); throw; } try { inFlightTransactionalState = TransactionalStorage.GetInFlightTransactionalState(Put, Delete); TransactionalStorage.Batch(actions => sequentialUuidGenerator.EtagBase = actions.General.GetNextIdentityValue("Raven/Etag")); // Index codecs must be initialized before we try to read an index InitializeIndexCodecTriggers(); IndexDefinitionStorage = new IndexDefinitionStorage( configuration, TransactionalStorage, configuration.DataDirectory, configuration.Container.GetExportedValues<AbstractViewGenerator>(), Extensions); IndexStorage = new IndexStorage(IndexDefinitionStorage, configuration, this); CompleteWorkContextSetup(); prefetcher = new Prefetcher(workContext); indexingExecuter = new IndexingExecuter(workContext, prefetcher); InitializeTriggersExceptIndexCodecs(); SecondStageInitialization(); ExecuteStartupTasks(); log.Debug("Finish loading the following database: {0}", configuration.DatabaseName ?? Constants.SystemDatabase); } catch (Exception) { Dispose(); throw; } } }
public DocumentDatabase(InMemoryRavenConfiguration configuration) { this.configuration = configuration; using (LogManager.OpenMappedContext("database", configuration.DatabaseName ?? Constants.SystemDatabase)) { if (configuration.IsTenantDatabase == false) { validateLicense = new ValidateLicense(); validateLicense.Execute(configuration); } AppDomain.CurrentDomain.DomainUnload += DomainUnloadOrProcessExit; AppDomain.CurrentDomain.ProcessExit += DomainUnloadOrProcessExit; Name = configuration.DatabaseName; backgroundTaskScheduler = configuration.CustomTaskScheduler ?? TaskScheduler.Current; ExtensionsState = new AtomicDictionary<object>(); Configuration = configuration; ExecuteAlterConfiguration(); configuration.Container.SatisfyImportsOnce(this); workContext = new WorkContext { Database = this, DatabaseName = Name, IndexUpdateTriggers = IndexUpdateTriggers, ReadTriggers = ReadTriggers, RaiseIndexChangeNotification = RaiseNotifications, TaskScheduler = backgroundTaskScheduler, Configuration = configuration }; TransactionalStorage = configuration.CreateTransactionalStorage(workContext.HandleWorkNotifications); try { sequentialUuidGenerator = new SequentialUuidGenerator(); TransactionalStorage.Initialize(sequentialUuidGenerator, DocumentCodecs); } catch (Exception) { TransactionalStorage.Dispose(); throw; } try { TransactionalStorage.Batch(actions => sequentialUuidGenerator.EtagBase = actions.General.GetNextIdentityValue("Raven/Etag")); TransportState = new TransportState(); // Index codecs must be initialized before we try to read an index InitializeIndexCodecTriggers(); IndexDefinitionStorage = new IndexDefinitionStorage( configuration, TransactionalStorage, configuration.DataDirectory, configuration.Container.GetExportedValues<AbstractViewGenerator>(), Extensions); IndexStorage = new IndexStorage(IndexDefinitionStorage, configuration, this); CompleteWorkContextSetup(); indexingExecuter = new IndexingExecuter(workContext); InitializeTriggersExceptIndexCodecs(); SecondStageInitialization(); ExecuteStartupTasks(); } catch (Exception) { Dispose(); throw; } } }
public DocumentDatabase(InMemoryRavenConfiguration configuration) { if (configuration.IsTenantDatabase == false) { validateLicense = new ValidateLicense(); validateLicense.Execute(configuration); } AppDomain.CurrentDomain.DomainUnload += DomainUnloadOrProcessExit; AppDomain.CurrentDomain.ProcessExit += DomainUnloadOrProcessExit; Name = configuration.DatabaseName; if (configuration.CustomTaskScheduler != null) { backgroundTaskScheduler = configuration.CustomTaskScheduler; } else if (configuration.BackgroundTasksPriority != ThreadPriority.Normal) { backgroundTaskScheduler = new TaskSchedulerWithCustomPriority( // we need a minimum of four task threads - one for indexing dispatch, one for reducing dispatch, one for tasks, one for indexing/reducing ops Math.Max(4, configuration.MaxNumberOfParallelIndexTasks + 2), configuration.BackgroundTasksPriority); } else { backgroundTaskScheduler = TaskScheduler.Current; } ExtensionsState = new AtomicDictionary<object>(); Configuration = configuration; ExecuteAlterConfiguration(); configuration.Container.SatisfyImportsOnce(this); workContext = new WorkContext { DatabaseName = Name, IndexUpdateTriggers = IndexUpdateTriggers, ReadTriggers = ReadTriggers, RaiseIndexChangeNotification = RaiseNotifications, TaskScheduler = backgroundTaskScheduler, Configuration = configuration }; TransactionalStorage = configuration.CreateTransactionalStorage(workContext.HandleWorkNotifications); try { TransactionalStorage.Initialize(this, DocumentCodecs); } catch (Exception) { TransactionalStorage.Dispose(); throw; } try { TransactionalStorage.Batch(actions => currentEtagBase = actions.General.GetNextIdentityValue("Raven/Etag")); TransportState = new TransportState(); // Index codecs must be initialized before we try to read an index InitializeIndexCodecTriggers(); IndexDefinitionStorage = new IndexDefinitionStorage( configuration, TransactionalStorage, configuration.DataDirectory, configuration.Container.GetExportedValues<AbstractViewGenerator>(), Extensions); IndexStorage = new IndexStorage(IndexDefinitionStorage, configuration, this); CompleteWorkContextSetup(); indexingExecuter = new IndexingExecuter(workContext); InitializeTriggersExceptIndexCodecs(); ExecuteStartupTasks(); } catch (Exception) { Dispose(); throw; } }