本文整理汇总了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();
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
}