public OwinHttpServer(InMemoryRavenConfiguration config, DocumentDatabase db = null, bool useHttpServer = true, Action<RavenDBOptions> configure = null) { startup = new Startup(config, db); if (configure != null) configure(startup.Options); owinEmbeddedHost = OwinEmbeddedHost.Create(app => startup.Configuration(app)); if (!useHttpServer) { return; } server = WebApp.Start("http://+:" + config.Port, app => //TODO DH: configuration.ServerUrl doesn't bind properly { var listener = (HttpListener) app.Properties["System.Net.HttpListener"]; if (listener != null) { new WindowsAuthConfigureHttpListener().Configure(listener, config); } startup.Configuration(app); app.Use(async (context, _) => { context.Response.StatusCode = 404; context.Response.ReasonPhrase = "Not Found"; await context.Response.Body.WriteAsync(NotFoundBody, 0, NotFoundBody.Length); }); }); }
public void EnableHttpServer(InMemoryRavenConfiguration config) { if(server != null) throw new InvalidOperationException("Http server is already running"); var schema = config.Encryption.UseSsl ? "https" : "http"; server = WebApp.Start(schema + "://+:" + config.Port, app => //TODO DH: configuration.ServerUrl doesn't bind properly { var listener = (HttpListener) app.Properties["System.Net.HttpListener"]; if (listener != null) new WindowsAuthConfigureHttpListener().Configure(listener, config); startup.Configuration(app); if (listener != null && config.Http.AuthenticationSchemes.HasValue) listener.AuthenticationSchemes = config.Http.AuthenticationSchemes.Value; app.Use(async (context, _) => { context.Response.StatusCode = 404; context.Response.ReasonPhrase = "Not Found"; await context.Response.Body.WriteAsync(NotFoundBody, 0, NotFoundBody.Length); }); }); }
public IndexStorage(IndexDefinitionStorage indexDefinitionStorage, InMemoryRavenConfiguration configuration, DocumentDatabase documentDatabase) { this.indexDefinitionStorage = indexDefinitionStorage; this.configuration = configuration; path = configuration.IndexStoragePath; if (Directory.Exists(path) == false && configuration.RunInMemory == false) Directory.CreateDirectory(path); if (configuration.RunInMemory == false) { var crashMarkerPath = Path.Combine(path, "indexing.crash-marker"); if (File.Exists(crashMarkerPath)) { // the only way this can happen is if we crashed because of a power outage // in this case, we consider all open indexes to be corrupt and force them // to be reset. This is because to get better perf, we don't flush the files to disk, // so in the case of a power outage, we can't be sure that there wasn't still stuff in // the OS buffer that wasn't written yet. configuration.ResetIndexOnUncleanShutdown = true; } // The delete on close ensures that the only way this file will exists is if there was // a power outage while the server was running. crashMarker = File.Create(crashMarkerPath, 16, FileOptions.DeleteOnClose); } foreach (var indexName in indexDefinitionStorage.IndexNames) { OpenIndexOnStartup(documentDatabase, indexName); } }
public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState receivedTransportState = null) { ExtensionsState = new AtomicDictionary<object>(); Name = name; this.systemConfiguration = systemConfiguration; systemConfiguration.Container.SatisfyImportsOnce(this); transportState = receivedTransportState ?? new TransportState(); storage = CreateTransactionalStorage(systemConfiguration); sigGenerator = new SigGenerator(); fileLockManager = new FileLockManager(); BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024); conflictDetector = new ConflictDetector(); conflictResolver = new ConflictResolver(storage, new CompositionContainer(systemConfiguration.Catalog)); notificationPublisher = new NotificationPublisher(transportState); synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration); metricsCounters = new MetricsCountersManager(); search = new IndexStorage(name, systemConfiguration); conflictArtifactManager = new ConflictArtifactManager(storage, search); storageOperationsTask = new StorageOperationsTask(storage, DeleteTriggers, search, notificationPublisher); AppDomain.CurrentDomain.ProcessExit += ShouldDispose; AppDomain.CurrentDomain.DomainUnload += ShouldDispose; }
public RestoreOperation(string backupLocation, InMemoryRavenConfiguration configuration, Action<string> output, bool defrag) { this.output = output; this.defrag = defrag; this.backupLocation = backupLocation.ToFullPath(); this.configuration = configuration; }
public RavenDBOptions(InMemoryRavenConfiguration configuration, DocumentDatabase db = null) { if (configuration == null) throw new ArgumentNullException("configuration"); try { HttpEndpointRegistration.RegisterHttpEndpointTarget(); HttpEndpointRegistration.RegisterAdminLogsTarget(); if (db == null) { configuration.UpdateDataDirForLegacySystemDb(); systemDatabase = new DocumentDatabase(configuration); systemDatabase.SpinBackgroundWorkers(); } else { systemDatabase = db; } fileSystemLandlord = new FileSystemsLandlord(systemDatabase); databasesLandlord = new DatabasesLandlord(systemDatabase); countersLandlord = new CountersLandlord(systemDatabase); requestManager = new RequestManager(databasesLandlord); mixedModeRequestAuthorizer = new MixedModeRequestAuthorizer(); mixedModeRequestAuthorizer.Initialize(systemDatabase, new RavenServer(databasesLandlord.SystemDatabase, configuration)); } catch { if (systemDatabase != null) systemDatabase.Dispose(); throw; } }
protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration) { configuration.Settings["Raven/Esent/CircularLog"] = "false"; configuration.Settings["Raven/Voron/AllowIncrementalBackups"] = "true"; configuration.RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false; configuration.Initialize(); }
protected override bool TryGetOrCreateResourceStore(string tenantId, out IResourceStore database) { if (ResourcesStoresCache.TryGetValue(tenantId, out database)) return true; var jsonDocument = DefaultDatabase.Get("Raven/Databases/" + tenantId, null); if (jsonDocument == null) return false; var document = jsonDocument.DataAsJson.JsonDeserialization<DatabaseDocument>(); database = ResourcesStoresCache.GetOrAdd(tenantId, s => { var config = new InMemoryRavenConfiguration { Settings = DefaultConfiguration.Settings, }; config.Settings["Raven/VirtualDir"] = config.Settings["Raven/VirtualDir"] + "/" + tenantId; foreach (var setting in document.Settings) { config.Settings[setting.Key] = setting.Value; } config.Initialize(); return new DocumentDatabase(config); }); return true; }
public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState recievedTransportState = null) { this.Name = name; this.systemConfiguration = systemConfiguration; var storageType = systemConfiguration.FileSystem.DefaultStorageTypeName; storage = CreateTransactionalStorage(storageType, systemConfiguration); search = new IndexStorage(systemConfiguration.FileSystem.IndexStoragePath, systemConfiguration.Settings); sigGenerator = new SigGenerator(); var replicationHiLo = new SynchronizationHiLo(storage); var sequenceActions = new SequenceActions(storage); transportState = recievedTransportState ?? new TransportState(); notificationPublisher = new NotificationPublisher(transportState); fileLockManager = new FileLockManager(); storage.Initialize(); search.Initialize(); var uuidGenerator = new UuidGenerator(sequenceActions); historian = new Historian(storage, replicationHiLo, uuidGenerator); BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024); conflictArtifactManager = new ConflictArtifactManager(storage, search); conflictDetector = new ConflictDetector(); conflictResolver = new ConflictResolver(storage, new CompositionContainer(systemConfiguration.Catalog)); synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration); storageOperationsTask = new StorageOperationsTask(storage, search, notificationPublisher); metricsCounters = new MetricsCountersManager(); AppDomain.CurrentDomain.ProcessExit += ShouldDispose; AppDomain.CurrentDomain.DomainUnload += ShouldDispose; }
public DocumentCacher(InMemoryRavenConfiguration configuration) { this.configuration = configuration; cachedSerializedDocuments = CreateCache(); MemoryStatistics.RegisterLowMemoryHandler(this); }
private InMemoryRavenConfiguration CreateIndexConfiguration () { var configuration = new InMemoryRavenConfiguration(); configuration.FileSystem.IndexStoragePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); return configuration; }
public void Configure(HttpListener listener, InMemoryRavenConfiguration config) { if (string.Equals(config.AuthenticationMode, "Windows",StringComparison.InvariantCultureIgnoreCase) == false) return; switch (config.AnonymousUserAccessMode) { case AnonymousUserAccessMode.None: listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication; break; case AnonymousUserAccessMode.All: listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication | AuthenticationSchemes.Anonymous; listener.AuthenticationSchemeSelectorDelegate = request => { if (request.RawUrl.StartsWith("/admin", StringComparison.InvariantCultureIgnoreCase)) return AuthenticationSchemes.IntegratedWindowsAuthentication; return AuthenticationSchemes.Anonymous; }; break; case AnonymousUserAccessMode.Get: listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication | AuthenticationSchemes.Anonymous; listener.AuthenticationSchemeSelectorDelegate = request => { return AbstractRequestAuthorizer.IsGetRequest(request.HttpMethod, request.Url.AbsolutePath) ? AuthenticationSchemes.Anonymous | AuthenticationSchemes.IntegratedWindowsAuthentication : AuthenticationSchemes.IntegratedWindowsAuthentication; }; break; default: throw new ArgumentException("Cannot understand access mode: " + config.AnonymousUserAccessMode); } }
protected ITransactionalStorage NewTransactionalStorage(string requestedStorage, bool runInMemory = true, string path = null) { path = path ?? NewDataPath(); var configuration = new InMemoryRavenConfiguration { FileSystem = { DataDirectory = path }, Settings = new NameValueCollection { { Constants.RunInMemory, runInMemory.ToString() } } }; ITransactionalStorage storage; switch (requestedStorage) { case "esent": storage = new Raven.Database.FileSystem.Storage.Esent.TransactionalStorage(configuration); break; case "voron": storage = new Raven.Database.FileSystem.Storage.Voron.TransactionalStorage(configuration); break; default: throw new NotSupportedException(string.Format("Given storage type ({0}) is not supported.", requestedStorage)); } storages.Add(storage); storage.Initialize(new OrderedPartCollection<AbstractFileCodec>()); return storage; }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { this.configuration = configuration; this.onCommit = onCommit; documentCacher = new DocumentCacher(configuration); exitLockDisposable = new DisposableAction(() => Monitor.Exit(this)); }
private void ExecuteInternal(InMemoryRavenConfiguration config) { var licensePath = GetLicensePath(config); var licenseText = GetLicenseText(config); if (TryLoadLicense(licenseText) == false) return; try { licenseValidator.AssertValidLicense(() => { string value; LicenseAttributes = licenseValidator.LicenseAttributes; AssertForV2(licenseValidator.LicenseAttributes); if (licenseValidator.LicenseAttributes.TryGetValue("OEM", out value) && "true".Equals(value, StringComparison.InvariantCultureIgnoreCase)) { licenseValidator.MultipleLicenseUsageBehavior = AbstractLicenseValidator.MultipleLicenseUsage.AllowSameLicense; } }); CurrentLicense = new LicensingStatus { Status = "Commercial - " + licenseValidator.LicenseType, Error = false, Message = "Valid license at " + licensePath, Attributes = licenseValidator.LicenseAttributes }; } catch (Exception e) { logger.ErrorException("Could not validate license at " + licensePath + ", " + licenseText, e); try { var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(licensePath); var sig = xmlDocument.SelectSingleNode("/license/Signature"); if (sig != null && sig.ParentNode != null) sig.ParentNode.RemoveChild(sig); var stringBuilder = new StringBuilder(); xmlDocument.WriteTo(XmlWriter.Create(stringBuilder)); licenseText = stringBuilder.ToString(); } catch (Exception) { // couldn't remove the signature, maybe not XML? } CurrentLicense = new LicensingStatus { Status = "AGPL - Open Source", Error = true, Message = "Could not validate license: " + licensePath + ", " + licenseText + Environment.NewLine + e }; } }
public void Execute(InMemoryRavenConfiguration config) { //We defer GettingNewLeaseSubscription the first time we run, we will run again with 1 minute so not to delay startup. timer = new Timer(state => ExecuteInternal(config), null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(15)); ExecuteInternal(config,true); }
public void Initialize(DocumentDatabase database, IRavenServer theServer) { this.database = database; this.settings = database.Configuration; this.server = theServer; Initialize(); }
public TransactionalStorage(InMemoryRavenConfiguration configuration) { this.configuration = configuration; path = configuration.FileSystemDataDirectory.ToFullPath(); settings = configuration.Settings; bufferPool = new BufferPool(2L * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit) }
public void Configure(HttpListener listener, InMemoryRavenConfiguration config) { configuration = config; listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication | AuthenticationSchemes.Anonymous; listener.AuthenticationSchemeSelectorDelegate += AuthenticationSchemeSelectorDelegate; }
public SchemaCreator(InMemoryRavenConfiguration configuration, TableStorage storage, Action<string> output, ILog log) { this.storage = storage; this.output = output; this.log = log; configuration.Container.SatisfyImportsOnce(this); }
private void HandleRequest(GetRequest[] requests, GetResponse[] results, int i, IHttpContext context, InMemoryRavenConfiguration ravenHttpConfiguration, MultiGetHttpContext[] contexts) { var request = requests[i]; if (request == null) return; server.HandleActualRequest(contexts[i]); results[i] = contexts[i].Complete(); }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { this.configuration = configuration; this.onCommit = onCommit; documentCacher = new DocumentCacher(configuration); exitLockDisposable = new DisposableAction(() => Monitor.Exit(this)); bufferPool = new BufferPool(configuration.Storage.Voron.MaxBufferPoolSize * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit) }
public HttpContextAdapter(HttpContext context, InMemoryRavenConfiguration configuration) { this.context = context; this.configuration = configuration; request = new HttpRequestAdapter(context.Request); response = new HttpResponseAdapter(context.Response); SetMaxAge(); }
public HttpListenerContextAdpater(HttpListenerContext ctx, InMemoryRavenConfiguration configuration) { this.ctx = ctx; this.configuration = configuration; ResponseInternal = new HttpListenerResponseAdapter(ctx.Response); RequestInternal = new HttpListenerRequestAdapter(ctx.Request); SetMaxAge(); }
public void Initialize(DocumentDatabase database, InMemoryRavenConfiguration settings, Func<string> tenantIdGetter, IRavenServer theServer) { server = theServer; this.database = database; this.settings = settings; this.tenantId = tenantIdGetter; Initialize(); }
public static string GetExtractedAssemblyLocationFor(Type type, InMemoryRavenConfiguration configuration) { if (File.Exists(type.Assembly.Location)) return type.Assembly.Location; var name = type.Assembly.GetName().Name; return Path.Combine(configuration.AssembliesDirectory, name + AssemblySuffix); }
public DocumentDatabase(InMemoryRavenConfiguration configuration) { Configuration = configuration; configuration.Container.SatisfyImportsOnce(this); workContext = new WorkContext { IndexUpdateTriggers = IndexUpdateTriggers, ReadTriggers = ReadTriggers }; dynamicQueryRunner = new DynamicQueryRunner(this); suggestionQueryRunner = new SuggestionQueryRunner(this); TransactionalStorage = configuration.CreateTransactionalStorage(workContext.HandleWorkNotifications); configuration.Container.SatisfyImportsOnce(TransactionalStorage); bool newDb; try { newDb = TransactionalStorage.Initialize(this); } catch (Exception) { TransactionalStorage.Dispose(); throw; } TransactionalStorage.Batch(actions => currentEtagBase = actions.General.GetNextIdentityValue("Raven/Etag")); IndexDefinitionStorage = new IndexDefinitionStorage( configuration, TransactionalStorage, configuration.DataDirectory, configuration.Container.GetExportedValues<AbstractViewGenerator>(), Extensions); IndexStorage = new IndexStorage(IndexDefinitionStorage, configuration); workContext.IndexStorage = IndexStorage; workContext.TransactionaStorage = TransactionalStorage; workContext.IndexDefinitionStorage = IndexDefinitionStorage; try { InitializeTriggers(); ExecuteStartupTasks(); } catch (Exception) { Dispose(); throw; } if (!newDb) return; OnNewlyCreatedDatabase(); }
public SubscriptionTests() { configuration = new InMemoryRavenConfiguration { RunInMemory = true }; configuration.Initialize(); ravenMqServer = new RavenMqServer(configuration); }
public RavenFileSystem(InMemoryRavenConfiguration config, string name, TransportState receivedTransportState = null) { ExtensionsState = new AtomicDictionary<object>(); Name = name; ResourceName = string.Concat(Abstractions.Data.Constants.FileSystem.UrlPrefix, "/", name); configuration = config; try { ValidateStorage(); configuration.Container.SatisfyImportsOnce(this); transportState = receivedTransportState ?? new TransportState(); storage = CreateTransactionalStorage(configuration); sigGenerator = new SigGenerator(); fileLockManager = new FileLockManager(); BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024); conflictDetector = new ConflictDetector(); conflictResolver = new ConflictResolver(storage, new CompositionContainer(configuration.Catalog)); notificationPublisher = new NotificationPublisher(transportState); synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, configuration); metricsCounters = new MetricsCountersManager(); search = new IndexStorage(name, configuration); conflictArtifactManager = new ConflictArtifactManager(storage, search); TimerManager = new ResourceTimerManager(); Tasks = new TaskActions(this, Log); Files = new FileActions(this, Log); Synchronizations = new SynchronizationActions(this, Log); AppDomain.CurrentDomain.ProcessExit += ShouldDispose; AppDomain.CurrentDomain.DomainUnload += ShouldDispose; } catch (Exception e) { Log.ErrorException(string.Format("Could not create file system '{0}'", Name ?? "unknown name"), e); try { Dispose(); } catch (Exception ex) { Log.FatalException("Failed to dispose when already getting an error in file system ctor", ex); } throw; } }
public SynchronizationTask(ITransactionalStorage storage, SigGenerator sigGenerator, NotificationPublisher publisher, InMemoryRavenConfiguration systemConfiguration) { this.storage = storage; this.publisher = publisher; this.systemConfiguration = systemConfiguration; context = new SynchronizationTaskContext(); synchronizationQueue = new SynchronizationQueue(); synchronizationStrategy = new SynchronizationStrategy(storage, sigGenerator); }
private static StorageEnvironmentOptions CreateStorageOptionsFromConfiguration(InMemoryRavenConfiguration configuration) { var directoryPath = configuration.DataDirectory ?? AppDomain.CurrentDomain.BaseDirectory; var filePathFolder = new DirectoryInfo(directoryPath); if (filePathFolder.Exists == false) { filePathFolder.Create(); } var tempPath = configuration.Storage.Voron.TempPath; var journalPath = configuration.Storage.Voron.JournalsStoragePath; var options = StorageEnvironmentOptions.ForPath(directoryPath, tempPath, journalPath); options.IncrementalBackupEnabled = configuration.Storage.Voron.AllowIncrementalBackups; options.InitialFileSize = configuration.Storage.Voron.InitialFileSize; options.MaxScratchBufferSize = configuration.Storage.Voron.MaxScratchBufferSize * 1024 * 1024; return(options); }
protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration) { configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.Admin; configuration.Catalog.Catalogs.Add(new TypeCatalog(typeof(AuditTrigger))); }
protected override void ModifyConfiguration(InMemoryRavenConfiguration ravenConfiguration) { ravenConfiguration.AnonymousUserAccessMode = AnonymousUserAccessMode.None; }
public SynchronizationTask(ITransactionalStorage storage, SigGenerator sigGenerator, NotificationPublisher publisher, InMemoryRavenConfiguration systemConfiguration) { this.storage = storage; this.publisher = publisher; this.systemConfiguration = systemConfiguration; context = new SynchronizationTaskContext(); synchronizationQueue = new SynchronizationQueue(); synchronizationStrategy = new SynchronizationStrategy(storage, sigGenerator, systemConfiguration); }
public RavenServer(DocumentDatabase systemDatabase, InMemoryRavenConfiguration systemConfiguration) { this.systemDatabase = systemDatabase; this.systemConfiguration = systemConfiguration; }
public void Compact(InMemoryRavenConfiguration ravenConfiguration, Action <string> output) { if (ravenConfiguration.RunInMemory) { throw new InvalidOperationException("Cannot compact in-memory running Voron storage"); } tableStorage.Dispose(); var sourcePath = ravenConfiguration.DataDirectory; var compactPath = Path.Combine(ravenConfiguration.DataDirectory, "Voron.Compaction"); if (Directory.Exists(compactPath)) { Directory.Delete(compactPath, true); } RecoverFromFailedCompact(sourcePath); var sourceOptions = CreateStorageOptionsFromConfiguration(ravenConfiguration); var compactOptions = (StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions)StorageEnvironmentOptions.ForPath(compactPath); output("Executing storage compaction"); StorageCompaction.Execute(sourceOptions, compactOptions, x => output(string.Format("Copied {0} of {1} records in '{2}' tree. Copied {3} of {4} trees.", x.CopiedTreeRecords, x.TotalTreeRecordsCount, x.TreeName, x.CopiedTrees, x.TotalTreeCount))); var sourceDir = new DirectoryInfo(sourcePath); var sourceFiles = new List <FileInfo>(); foreach (var pattern in new [] { "*.journal", "headers.one", "headers.two", VoronConstants.DatabaseFilename }) { sourceFiles.AddRange(sourceDir.GetFiles(pattern)); } var compactionBackup = Path.Combine(sourcePath, "Voron.Compaction.Backup"); if (Directory.Exists(compactionBackup)) { Directory.Delete(compactionBackup, true); output("Removing existing compaction backup directory"); } Directory.CreateDirectory(compactionBackup); output("Backing up original data files"); foreach (var file in sourceFiles) { File.Move(file.FullName, Path.Combine(compactionBackup, file.Name)); } var compactedFiles = new DirectoryInfo(compactPath).GetFiles(); output("Moving compacted files into target location"); foreach (var file in compactedFiles) { File.Move(file.FullName, Path.Combine(sourcePath, file.Name)); } output("Deleting original data backup"); Directory.Delete(compactionBackup, true); Directory.Delete(compactPath, true); }
public void Init(IUuidGenerator generator, InMemoryRavenConfiguration configuration) { }
protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration) { base.ModifyConfiguration(configuration); configuration.RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false; }
protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration) { configuration.Settings["Raven/ActiveBundles"] = "PeriodicBackup"; }
public void DefaultInMemoryRavenConfigurationShouldBeInitializedCorrectly() { var inMemoryConfiguration = new InMemoryRavenConfiguration(); inMemoryConfiguration.Initialize(); int defaultMaxNumberOfItemsToIndexInSingleBatch = Environment.Is64BitProcess ? 128 * 1024 : 16 * 1024; int defaultInitialNumberOfItemsToIndexInSingleBatch = Environment.Is64BitProcess ? 512 : 256; var stronglyTypedConfiguration = new StronglyTypedRavenSettings(inMemoryConfiguration.Settings); stronglyTypedConfiguration.Setup(defaultMaxNumberOfItemsToIndexInSingleBatch, defaultInitialNumberOfItemsToIndexInSingleBatch); var configurationComparer = new ConfigurationComparer(inMemoryConfiguration, stronglyTypedConfiguration, propertyPathsToIgnore); configurationComparer.Ignore(x => x.EnableResponseLoggingForEmbeddedDatabases); configurationComparer.Assert(expected => expected.RejectClientsModeEnabled.Value, actual => actual.RejectClientsMode); configurationComparer.Assert(expected => expected.MaxSecondsForTaskToWaitForDatabaseToLoad.Value, actual => actual.MaxSecondsForTaskToWaitForDatabaseToLoad); configurationComparer.Assert(expected => expected.NewIndexInMemoryMaxTime.Value, actual => actual.NewIndexInMemoryMaxTime); configurationComparer.Assert(expected => expected.Replication.FetchingFromDiskTimeoutInSeconds.Value, actual => actual.Replication.FetchingFromDiskTimeoutInSeconds); configurationComparer.Assert(expected => expected.Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb.Value, actual => actual.Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb); configurationComparer.Assert(expected => expected.Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds.Value, actual => actual.Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds); configurationComparer.Assert(expected => expected.Voron.AllowIncrementalBackups.Value, actual => actual.Storage.Voron.AllowIncrementalBackups); configurationComparer.Assert(expected => expected.Voron.InitialFileSize.Value, actual => actual.Storage.Voron.InitialFileSize); configurationComparer.Assert(expected => expected.Voron.MaxBufferPoolSize.Value, actual => actual.Storage.Voron.MaxBufferPoolSize); configurationComparer.Assert(expected => expected.Voron.MaxScratchBufferSize.Value, actual => actual.Storage.Voron.MaxScratchBufferSize); configurationComparer.Assert(expected => expected.Voron.TempPath.Value, actual => actual.Storage.Voron.TempPath); configurationComparer.Assert(expected => expected.FileSystem.MaximumSynchronizationInterval.Value, actual => actual.FileSystem.MaximumSynchronizationInterval); configurationComparer.Assert(expected => expected.Encryption.EncryptionKeyBitsPreference.Value, actual => actual.Encryption.EncryptionKeyBitsPreference); configurationComparer.Assert(expected => expected.Encryption.UseFips.Value, actual => actual.Encryption.UseFips); configurationComparer.Assert(expected => expected.Encryption.UseSsl.Value, actual => actual.Encryption.UseSsl); configurationComparer.Assert(expected => expected.MaxConcurrentServerRequests.Value, actual => actual.MaxConcurrentServerRequests); configurationComparer.Assert(expected => expected.PrefetchingDurationLimit.Value, actual => actual.PrefetchingDurationLimit); configurationComparer.Assert(expected => expected.BulkImportBatchTimeout.Value, actual => actual.BulkImportBatchTimeout); configurationComparer.Assert(expected => expected.DatbaseOperationTimeout.Value, actual => actual.DatabaseOperationTimeout); configurationComparer.Assert(expected => expected.TimeToWaitBeforeRunningIdleIndexes.Value, actual => actual.TimeToWaitBeforeRunningIdleIndexes); configurationComparer.Assert(expected => expected.TimeToWaitBeforeRunningAbandonedIndexes.Value, actual => actual.TimeToWaitBeforeRunningAbandonedIndexes); configurationComparer.Assert(expected => expected.TimeToWaitBeforeMarkingIdleIndexAsAbandoned.Value, actual => actual.TimeToWaitBeforeMarkingIdleIndexAsAbandoned); configurationComparer.Assert(expected => expected.TimeToWaitBeforeMarkingAutoIndexAsIdle.Value, actual => actual.TimeToWaitBeforeMarkingAutoIndexAsIdle); configurationComparer.Assert(expected => expected.RedirectStudioUrl.Value, actual => actual.RedirectStudioUrl); configurationComparer.Assert(expected => expected.ResetIndexOnUncleanShutdown.Value, actual => actual.ResetIndexOnUncleanShutdown); configurationComparer.Assert(expected => expected.MaxPageSize.Value, actual => actual.MaxPageSize); configurationComparer.Assert(expected => expected.MemoryCacheLimitPercentage.Value, actual => actual.MemoryCacheLimitPercentage); configurationComparer.Assert(expected => expected.MemoryCacheLimitMegabytes.Value, actual => actual.MemoryCacheLimitMegabytes); configurationComparer.Assert(expected => expected.MemoryCacheLimitCheckInterval.Value, actual => actual.MemoryCacheLimitCheckInterval); configurationComparer.Assert(expected => expected.MaxNumberOfItemsToProcessInSingleBatch.Value, actual => actual.MaxNumberOfItemsToProcessInSingleBatch); configurationComparer.Assert(expected => expected.MaxNumberOfItemsToReduceInSingleBatch.Value, actual => actual.MaxNumberOfItemsToReduceInSingleBatch); configurationComparer.Assert(expected => expected.NumberOfItemsToExecuteReduceInSingleStep.Value, actual => actual.NumberOfItemsToExecuteReduceInSingleStep); configurationComparer.Assert(expected => expected.NewIndexInMemoryMaxMb.Value, actual => actual.NewIndexInMemoryMaxBytes); configurationComparer.Assert(expected => expected.HostName.Value, actual => actual.HostName); configurationComparer.Assert(expected => expected.ExposeConfigOverTheWire.Value, actual => actual.ExposeConfigOverTheWire); configurationComparer.Assert(expected => expected.AccessControlMaxAge.Value, actual => actual.AccessControlMaxAge); configurationComparer.Assert(expected => expected.AccessControlAllowMethods.Value, actual => actual.AccessControlAllowMethods); configurationComparer.Assert(expected => expected.AccessControlRequestHeaders.Value, actual => actual.AccessControlRequestHeaders); configurationComparer.Assert(expected => expected.HttpCompression.Value, actual => actual.HttpCompression); configurationComparer.Assert(expected => expected.AllowLocalAccessWithoutAuthorization.Value, actual => actual.AllowLocalAccessWithoutAuthorization); configurationComparer.Assert(expected => expected.RunInMemory.Value, actual => actual.RunInMemory); configurationComparer.Assert(expected => expected.DisableInMemoryIndexing.Value, actual => actual.DisableInMemoryIndexing); configurationComparer.Assert(expected => expected.WebDir.Value, actual => actual.WebDir); configurationComparer.Assert(expected => expected.DisableDocumentPreFetching.Value, actual => actual.DisableDocumentPreFetching); configurationComparer.Assert(expected => expected.MaxNumberOfItemsToPreFetch.Value, actual => actual.MaxNumberOfItemsToPreFetch); configurationComparer.Assert(expected => expected.MemoryCacheExpiration.Value, actual => actual.MemoryCacheExpiration); configurationComparer.Assert(expected => expected.CreateAutoIndexesForAdHocQueriesIfNeeded.Value, actual => actual.CreateAutoIndexesForAdHocQueriesIfNeeded); configurationComparer.Assert(expected => expected.MaxIndexCommitPointStoreTimeInterval.Value, actual => actual.MaxIndexCommitPointStoreTimeInterval); configurationComparer.Assert(expected => expected.MinIndexingTimeIntervalToStoreCommitPoint.Value, actual => actual.MinIndexingTimeIntervalToStoreCommitPoint); configurationComparer.Assert(expected => expected.MaxNumberOfStoredCommitPoints.Value, actual => actual.MaxNumberOfStoredCommitPoints); configurationComparer.Assert(expected => expected.MemoryLimitForProcessing.Value, actual => actual.MemoryLimitForProcessingInMb); configurationComparer.Assert(expected => expected.AvailableMemoryForRaisingBatchSizeLimit.Value, actual => actual.AvailableMemoryForRaisingBatchSizeLimit); configurationComparer.Assert(expected => expected.MaxProcessingRunLatency.Value, actual => actual.MaxProcessingRunLatency); configurationComparer.Assert(expected => expected.DisableClusterDiscovery.Value, actual => actual.DisableClusterDiscovery); configurationComparer.Assert(expected => expected.ServerName.Value, actual => actual.ServerName); configurationComparer.Assert(expected => expected.MaxStepsForScript.Value, actual => actual.MaxStepsForScript); configurationComparer.Assert(expected => expected.MaxRecentTouchesToRemember.Value, actual => actual.MaxRecentTouchesToRemember); configurationComparer.Assert(expected => expected.AdditionalStepsForScriptBasedOnDocumentSize.Value, actual => actual.AdditionalStepsForScriptBasedOnDocumentSize); configurationComparer.Assert(expected => expected.MaxIndexWritesBeforeRecreate.Value, actual => actual.MaxIndexWritesBeforeRecreate); configurationComparer.Assert(expected => expected.MaxSimpleIndexOutputsPerDocument.Value, actual => actual.MaxSimpleIndexOutputsPerDocument); configurationComparer.Assert(expected => expected.MaxMapReduceIndexOutputsPerDocument.Value, actual => actual.MaxMapReduceIndexOutputsPerDocument); configurationComparer.Assert(expected => expected.PrewarmFacetsOnIndexingMaxAge.Value, actual => actual.PrewarmFacetsOnIndexingMaxAge); configurationComparer.Assert(expected => expected.PrewarmFacetsSyncronousWaitTime.Value, actual => actual.PrewarmFacetsSyncronousWaitTime); configurationComparer.Assert(expected => expected.MaxNumberOfParallelProcessingTasks.Value, actual => actual.MaxNumberOfParallelProcessingTasks); configurationComparer.Assert(expected => FilePathTools.MakeSureEndsWithSlash(expected.DataDir.Value.ToFullPath(null)), actual => actual.DataDirectory); configurationComparer.Assert(expected => FilePathTools.MakeSureEndsWithSlash(expected.CountersDataDir.Value.ToFullPath(null)), actual => actual.CountersDataDirectory); configurationComparer.Assert(expected => expected.PluginsDirectory.Value.ToFullPath(null), actual => actual.PluginsDirectory); configurationComparer.Assert(expected => expected.AssembliesDirectory.Value.ToFullPath(null), actual => actual.AssembliesDirectory); configurationComparer.Assert(expected => expected.EmbeddedFilesDirectory.Value.ToFullPath(null), actual => actual.EmbeddedFilesDirectory); configurationComparer.Assert(expected => FilePathTools.MakeSureEndsWithSlash(expected.FileSystem.DataDir.Value.ToFullPath(null)), actual => actual.FileSystem.DataDirectory); configurationComparer.Assert(expected => FilePathTools.MakeSureEndsWithSlash(expected.FileSystem.DataDir.Value.ToFullPath(null)) + @"Indexes", actual => actual.FileSystem.IndexStoragePath); configurationComparer.Assert(expected => expected.FileSystem.DefaultStorageTypeName.Value, actual => actual.FileSystem.DefaultStorageTypeName); configurationComparer.Assert(expected => expected.MaxConcurrentMultiGetRequests.Value, actual => actual.MaxConcurrentMultiGetRequests); configurationComparer.Assert(expected => FilePathTools.MakeSureEndsWithSlash(expected.DataDir.Value.ToFullPath(null)) + @"Indexes", actual => actual.IndexStoragePath); configurationComparer.Assert(expected => expected.DefaultStorageTypeName.Value, actual => actual.DefaultStorageTypeName); configurationComparer.Assert(expected => expected.CompiledIndexCacheDirectory.Value.ToFullPath(null), actual => actual.CompiledIndexCacheDirectory); configurationComparer.Assert(expected => expected.FlushIndexToDiskSizeInMb.Value, actual => actual.FlushIndexToDiskSizeInMb); configurationComparer.Assert(expected => expected.TombstoneRetentionTime.Value, actual => actual.TombstoneRetentionTime); configurationComparer.Assert(expected => expected.Replication.ReplicationRequestTimeoutInMilliseconds.Value, actual => actual.Replication.ReplicationRequestTimeoutInMilliseconds); configurationComparer.Assert(expected => expected.Indexing.MaxNumberOfItemsToProcessInTestIndexes.Value, actual => actual.Indexing.MaxNumberOfItemsToProcessInTestIndexes); configurationComparer.Assert(expected => expected.IndexAndTransformerReplicationLatencyInSec.Value, actual => actual.IndexAndTransformerReplicationLatencyInSec); configurationComparer.Assert(expected => expected.MaxConcurrentRequestsForDatabaseDuringLoad.Value, actual => actual.MaxConcurrentRequestsForDatabaseDuringLoad); configurationComparer.Assert(expected => expected.Replication.MaxNumberOfItemsToReceiveInSingleBatch.Value, actual => actual.Replication.MaxNumberOfItemsToReceiveInSingleBatch); configurationComparer.Ignore(x => x.Storage.Esent.JournalsStoragePath); configurationComparer.Ignore(x => x.Storage.Voron.JournalsStoragePath); Assert.NotNull(inMemoryConfiguration.OAuthTokenKey); Assert.Equal("/", inMemoryConfiguration.VirtualDirectory); Assert.Empty(inMemoryConfiguration.AccessControlAllowOrigin); Assert.NotNull(inMemoryConfiguration.ServerUrl); Assert.NotNull(inMemoryConfiguration.OAuthTokenServer); Assert.True(inMemoryConfiguration.UseDefaultOAuthTokenServer); Assert.Empty(inMemoryConfiguration.HeadersToIgnore); Assert.Equal(null, inMemoryConfiguration.CustomTaskScheduler); Assert.Empty(inMemoryConfiguration.ActiveBundles); Assert.Equal("*", stronglyTypedConfiguration.Port.Value); Assert.True(inMemoryConfiguration.Port >= 8080); Assert.Equal("Open", inMemoryConfiguration.ExposeConfigOverTheWire); Assert.True(inMemoryConfiguration.CreateAnalyzersDirectoryIfNotExisting); Assert.True(inMemoryConfiguration.CreatePluginsDirectoryIfNotExisting); Assert.Equal(null, inMemoryConfiguration.Storage.Esent.JournalsStoragePath); Assert.Equal(null, inMemoryConfiguration.Storage.Voron.JournalsStoragePath); configurationComparer.Validate(); }
public static void RegisterTemporalVersioningBundle(this InMemoryRavenConfiguration configuration) { configuration.Catalog.Catalogs.Add(new AssemblyCatalog(typeof(Extensions).Assembly)); configuration.Settings.AddBundle(TemporalConstants.BundleName); }
protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration) { configuration.Container = new CompositionContainer(new TypeCatalog( typeof(HiddenDocumentsTrigger))); }
private static StorageEnvironmentOptions CreateMemoryStorageOptionsFromConfiguration(InMemoryRavenConfiguration configuration) { var options = StorageEnvironmentOptions.CreateMemoryOnly(configuration.Storage.Voron.TempPath); options.InitialFileSize = configuration.Storage.Voron.InitialFileSize; options.MaxScratchBufferSize = configuration.Storage.Voron.MaxScratchBufferSize * 1024L * 1024L; return(options); }
private static StorageEnvironmentOptions CreateStorageOptionsFromConfiguration(InMemoryRavenConfiguration configuration) { var directoryPath = configuration.DataDirectory ?? AppDomain.CurrentDomain.BaseDirectory; var filePathFolder = new DirectoryInfo(directoryPath); if (filePathFolder.Exists == false) { if (EnvironmentUtils.RunningOnPosix == true) { uint permissions = 509; Syscall.mkdir(filePathFolder.Name, permissions); } else { filePathFolder.Create(); } } var tempPath = configuration.Storage.Voron.TempPath; var journalPath = configuration.Storage.Voron.JournalsStoragePath; var options = StorageEnvironmentOptions.ForPath(directoryPath, tempPath, journalPath); options.IncrementalBackupEnabled = configuration.Storage.Voron.AllowIncrementalBackups; options.InitialFileSize = configuration.Storage.Voron.InitialFileSize; options.MaxScratchBufferSize = configuration.Storage.Voron.MaxScratchBufferSize * 1024L * 1024L; return(options); }
protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration) { configuration.MaxSecondsForTaskToWaitForDatabaseToLoad = 10; base.ModifyConfiguration(configuration); }
public DynamicViewCompiler(string name, IndexDefinition indexDefinition, OrderedPartCollection <AbstractDynamicCompilationExtension> extensions, string basePath, InMemoryRavenConfiguration configuration) : base(configuration, extensions, name, basePath) { this.indexDefinition = indexDefinition; RequiresSelectNewAnonymousType = true; }
public void AlterConfiguration(InMemoryRavenConfiguration configuration) { configuration.HttpCompression = false; configuration.TempIndexCleanupPeriod = TimeSpan.FromMinutes(30); }
protected virtual void ModifyConfiguration(InMemoryRavenConfiguration configuration) { }