当前位置: 首页>>代码示例>>C#>>正文


C# InMemoryRavenConfiguration.CreateTransactionalStorage方法代码示例

本文整理汇总了C#中InMemoryRavenConfiguration.CreateTransactionalStorage方法的典型用法代码示例。如果您正苦于以下问题:C# InMemoryRavenConfiguration.CreateTransactionalStorage方法的具体用法?C# InMemoryRavenConfiguration.CreateTransactionalStorage怎么用?C# InMemoryRavenConfiguration.CreateTransactionalStorage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InMemoryRavenConfiguration的用法示例。


在下文中一共展示了InMemoryRavenConfiguration.CreateTransactionalStorage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DocumentDatabase

        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();
        }
开发者ID:vinone,项目名称:ravendb,代码行数:57,代码来源:DocumentDatabase.cs

示例2: DocumentDatabase

		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;
				}
			}
		}
开发者ID:samueldjack,项目名称:ravendb,代码行数:83,代码来源:DocumentDatabase.cs

示例3: DocumentDatabase

		public DocumentDatabase(InMemoryRavenConfiguration configuration)
		{
			ExternalState = new ConcurrentDictionary<string, object>();
			Name = configuration.DatabaseName;
			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 ConcurrentDictionary<object, object>();
			Configuration = configuration;
			
			ExecuteAlterConfiguration();

			configuration.Container.SatisfyImportsOnce(this);

			workContext = new WorkContext
			{
				IndexUpdateTriggers = IndexUpdateTriggers,
				ReadTriggers = ReadTriggers
			};

			TransactionalStorage = configuration.CreateTransactionalStorage(workContext.HandleWorkNotifications);
			configuration.Container.SatisfyImportsOnce(TransactionalStorage);

			try
			{
				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.Configuration = configuration;
			workContext.IndexStorage = IndexStorage;
			workContext.TransactionaStorage = TransactionalStorage;
			workContext.IndexDefinitionStorage = IndexDefinitionStorage;


			try
			{
				InitializeTriggers();
				ExecuteStartupTasks();
			}
			catch (Exception)
			{
				Dispose();
				throw;
			}
		}
开发者ID:chanan,项目名称:ravendb,代码行数:69,代码来源:DocumentDatabase.cs

示例4: TryToCreateTransactionalStorage

        public static bool TryToCreateTransactionalStorage(InMemoryRavenConfiguration ravenConfiguration,
            bool hasCompression, EncryptionConfiguration encryption, out ITransactionalStorage storage)
        {
            storage = null;
            if (File.Exists(Path.Combine(ravenConfiguration.DataDirectory, Voron.Impl.Constants.DatabaseFilename)))
                storage = ravenConfiguration.CreateTransactionalStorage(InMemoryRavenConfiguration.VoronTypeName, () => { }, () => { });
            else if (File.Exists(Path.Combine(ravenConfiguration.DataDirectory, "Data")))
                storage = ravenConfiguration.CreateTransactionalStorage(InMemoryRavenConfiguration.EsentTypeName, () => { }, () => { });

            if (storage == null)
                return false;

            var orderedPartCollection = new OrderedPartCollection<AbstractDocumentCodec>();
            if (encryption != null)
            {
                var documentEncryption = new DocumentEncryption();
                documentEncryption.SetSettings(new EncryptionSettings(encryption.EncryptionKey, encryption.SymmetricAlgorithmType,
                    encryption.EncryptIndexes, encryption.PreferedEncryptionKeyBitsSize));
                orderedPartCollection.Add(documentEncryption);
            }
            if (hasCompression)
            {
                orderedPartCollection.Add(new DocumentCompression());
            }
                
            storage.Initialize(new SequentialUuidGenerator {EtagBase = 0}, orderedPartCollection);
            return true;
        }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:28,代码来源:StorageExporter.cs

示例5: DocumentDatabase

        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;
                }
            }
        }
开发者ID:nishizhen,项目名称:ravendb,代码行数:92,代码来源:DocumentDatabase.cs

示例6: TryToCreateTransactionalStorage

 public static bool TryToCreateTransactionalStorage(InMemoryRavenConfiguration ravenConfiguration, out ITransactionalStorage storage)
 {
     storage = null;
     if (File.Exists(Path.Combine(ravenConfiguration.DataDirectory, Voron.Impl.Constants.DatabaseFilename)))
         storage = ravenConfiguration.CreateTransactionalStorage(InMemoryRavenConfiguration.VoronTypeName, () => { }, () => { });
     else if (File.Exists(Path.Combine(ravenConfiguration.DataDirectory, "Data")))
         storage = ravenConfiguration.CreateTransactionalStorage(InMemoryRavenConfiguration.EsentTypeName, () => { }, () => { });
     if (storage != null)
     {
         storage.Initialize(new SequentialUuidGenerator {EtagBase = 0}, new OrderedPartCollection<AbstractDocumentCodec>());
         return true;
     }
     return false;
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:14,代码来源:StorageExporter.cs

示例7: DocumentDatabase

		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;
			}
		}
开发者ID:denno-secqtinstien,项目名称:ravendb,代码行数:88,代码来源:DocumentDatabase.cs


注:本文中的InMemoryRavenConfiguration.CreateTransactionalStorage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。