Beispiel #1
0
 /// <summary>
 ///     Document store should only have one instance per application
 /// </summary>
 /// <param name="databaseName"></param>
 /// <param name="logger"></param>
 /// <param name="databaseOptions"></param>
 public PecanDocumentStore(string databaseName, DatabaseOptions databaseOptions = null)
 {
     databaseOptions = databaseOptions ?? new DatabaseOptions();
     this.Logger     = databaseOptions.Logger;
     //DatabaseOptions = databaseOptions;
     this.CreateDB(databaseName, databaseOptions, databaseOptions.UseSingleFile);
 }
Beispiel #2
0
        private void CreateDB(string databaseName, DatabaseOptions databaseOptions, bool useSingleFile)
        {
            this.DataBaseStartedAt  = DateTime.UtcNow;
            this.DataBaseName       = databaseName;
            this.DatabaseOptions    = databaseOptions;
            this.UseInMemoryStorage = databaseOptions?.UseInMemoryStorage ?? false;

            this.databaseService = new DatabaseService(databaseOptions.StorageDirectory, databaseName, new JsonSerializationFactory(this.Logger), databaseOptions.StorageIO, this.Logger, false, databaseOptions.StorageName);
            if (this.DatabaseOptions == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(databaseOptions.RunAsServerWithAddress))
            {
                RemoteAccess = new RemoteAccess();
                RemoteAccess.RunServer(databaseOptions.RunAsServerWithAddress);
            }

            this.RemoteServerAdrress = databaseOptions.UseRemoteServerAdrressForClientRequests;
            this.databaseService.DataBaseSettings.EnableCaching = this.DatabaseOptions.EnableCaching;
            this.databaseService.DataBaseSettings.EnableFasterCachingButWithLeakyUpdates = this.DatabaseOptions.EnableFasterCachingButWithLeakyUpdates;
            this.databaseService.DataBaseSettings.MaxResponseTime           = this.DatabaseOptions.MaxResponseTime;
            this.databaseService.DataBaseSettings.PrettifyDocuments         = this.DatabaseOptions.PrettifyDocuments;
            this.databaseService.DataBaseSettings.DontWaitForWrites         = this.DatabaseOptions.DontWaitForWrites;
            this.databaseService.DataBaseSettings.DontWaitForWritesOnCreate = this.DatabaseOptions.DontWaitForWritesOnCreate;
        }
Beispiel #3
0
 public DocumentStoreInMemory(DatabaseOptions databaseOptions = null)
     : base(Guid.NewGuid().ToString(), true, databaseOptions)
 {
 }
Beispiel #4
0
 /// <summary>
 ///     Document store should only have one instance per application
 /// </summary>
 /// <param name="databaseName"></param>
 /// <param name="databaseOptions"></param>
 public PecanDocumentStore(string databaseName, bool useInMemory, DatabaseOptions databaseOptions = null)
 {
     databaseOptions = databaseOptions ?? new DatabaseOptions();
     databaseOptions.UseInMemoryStorage = useInMemory;
     this.CreateDB(databaseName, databaseOptions, databaseOptions?.UseSingleFile ?? false);
 }