本文整理汇总了C#中ITransactionalStorage.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# ITransactionalStorage.Initialize方法的具体用法?C# ITransactionalStorage.Initialize怎么用?C# ITransactionalStorage.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITransactionalStorage
的用法示例。
在下文中一共展示了ITransactionalStorage.Initialize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: when_there_are_multiple_map_results_for_multiple_indexes
private static void when_there_are_multiple_map_results_for_multiple_indexes(ITransactionalStorage transactionalStorage)
{
transactionalStorage.Initialize(new DummyUuidGenerator());
transactionalStorage.Batch(accessor =>
{
accessor.Indexing.AddIndex("a",true);
accessor.Indexing.AddIndex("b", true);
accessor.Indexing.AddIndex("c", true);
accessor.MappedResults.PutMappedResult("a", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("a", "a"));
accessor.MappedResults.PutMappedResult("a", "a/2", "a", new RavenJObject(), MapReduceIndex.ComputeHash("a", "a"));
accessor.MappedResults.PutMappedResult("b", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("b", "a"));
accessor.MappedResults.PutMappedResult("b", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("b", "a"));
accessor.MappedResults.PutMappedResult("c", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("c", "a"));
accessor.MappedResults.PutMappedResult("c", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("c", "a"));
});
transactionalStorage.Batch(actionsAccessor =>
{
Assert.True(actionsAccessor.Staleness.IsReduceStale("a"));
Assert.True(actionsAccessor.Staleness.IsReduceStale("b"));
Assert.True(actionsAccessor.Staleness.IsReduceStale("c"));
});
}
示例2: RavenFileSystem
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;
}
示例3: ViewStorage
public ViewStorage()
{
transactionalStorage = new TransactionalStorage(new RavenConfiguration
{
DataDirectory = "raven.db.test.esent",
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
}, () => { });
transactionalStorage.Initialize();
}
示例4: ViewStorage
public ViewStorage()
{
transactionalStorage = new TransactionalStorage(new RavenConfiguration
{
DataDirectory = DataDir,
RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
}, () => { });
transactionalStorage.Initialize(new DummyUuidGenerator());
}
示例5: RavenFileSystem
public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, TransportState transportState, string name)
{
this.Name = name;
this.systemConfiguration = systemConfiguration;
var storageType = systemConfiguration.DefaultFileSystemStorageTypeName;
if (string.Equals(InMemoryRavenConfiguration.VoronTypeName, storageType, StringComparison.OrdinalIgnoreCase) == false)
{
if (Directory.Exists(systemConfiguration.FileSystemDataDirectory) &&
Directory.EnumerateFileSystemEntries(systemConfiguration.FileSystemDataDirectory).Any())
throw new InvalidOperationException(
string.Format(
"We do not allow to run on a storage engine other then Voron, while we are in the early pre-release phase of RavenDB 3.0. You are currently running on {0}",
storageType));
Trace.WriteLine("Forcing filesystem to run on Voron - pre release behavior only, mind " + Path.GetFileName(Path.GetDirectoryName(systemConfiguration.FileSystemDataDirectory)));
storageType = InMemoryRavenConfiguration.VoronTypeName;
}
storage = CreateTransactionalStorage(storageType, systemConfiguration.FileSystemDataDirectory, systemConfiguration.Settings);
search = new IndexStorage(systemConfiguration.FileSystemIndexStoragePath, systemConfiguration.Settings);
sigGenerator = new SigGenerator();
var replicationHiLo = new SynchronizationHiLo(storage);
var sequenceActions = new SequenceActions(storage);
this.transportState = 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();
synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);
storageOperationsTask = new StorageOperationsTask(storage, search, notificationPublisher);
metricsCounters = new MetricsCountersManager();
AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
}
示例6: when_there_are_updates_to_map_reduce_results
private static void when_there_are_updates_to_map_reduce_results(ITransactionalStorage transactionalStorage)
{
var dummyUuidGenerator = new DummyUuidGenerator();
transactionalStorage.Initialize(dummyUuidGenerator);
Guid a = Guid.Empty;
Guid b = Guid.Empty;
Guid c = Guid.Empty;
transactionalStorage.Batch(accessor =>
{
accessor.Indexing.AddIndex("a", true);
accessor.Indexing.AddIndex("b", true);
accessor.Indexing.AddIndex("c", true);
accessor.MappedResults.PutMappedResult("a", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("a", "a"));
a = dummyUuidGenerator.CreateSequentialUuid();
accessor.MappedResults.PutMappedResult("a", "a/2", "a", new RavenJObject(), MapReduceIndex.ComputeHash("a", "a"));
accessor.MappedResults.PutMappedResult("b", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("b", "a"));
b = dummyUuidGenerator.CreateSequentialUuid();
accessor.MappedResults.PutMappedResult("b", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("b", "a"));
accessor.MappedResults.PutMappedResult("c", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("c", "a"));
c = dummyUuidGenerator.CreateSequentialUuid();
accessor.MappedResults.PutMappedResult("c", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("c", "a"));
});
transactionalStorage.Batch(actionsAccessor =>
{
Assert.Equal(1, actionsAccessor.MappedResults.GetMappedResultsReduceKeysAfter("a", a).Count());
Assert.Equal(1, actionsAccessor.MappedResults.GetMappedResultsReduceKeysAfter("b", b).Count());
Assert.Equal(1, actionsAccessor.MappedResults.GetMappedResultsReduceKeysAfter("c", c).Count());
});
}
示例7: when_there_are_multiple_map_results_and_we_ask_for_results
private static void when_there_are_multiple_map_results_and_we_ask_for_results(ITransactionalStorage transactionalStorage)
{
transactionalStorage.Initialize(new DummyUuidGenerator());
transactionalStorage.Batch(accessor =>
{
accessor.Indexing.AddIndex("a", true);
accessor.Indexing.AddIndex("b", true);
accessor.Indexing.AddIndex("c", true);
accessor.MappedResults.PutMappedResult("a", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("a", "a"));
accessor.MappedResults.PutMappedResult("a", "a/2", "a", new RavenJObject(), MapReduceIndex.ComputeHash("a", "a"));
accessor.MappedResults.PutMappedResult("b", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("b", "a"));
accessor.MappedResults.PutMappedResult("b", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("b", "a"));
accessor.MappedResults.PutMappedResult("c", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("c", "a"));
accessor.MappedResults.PutMappedResult("c", "a/1", "a", new RavenJObject(), MapReduceIndex.ComputeHash("c", "a"));
});
transactionalStorage.Batch(actionsAccessor =>
{
Assert.Equal(2, actionsAccessor.MappedResults.GetMappedResultsReduceKeysAfter("a", Guid.Empty).Count());
Assert.Equal(2, actionsAccessor.MappedResults.GetMappedResultsReduceKeysAfter("b", Guid.Empty).Count());
Assert.Equal(2, actionsAccessor.MappedResults.GetMappedResultsReduceKeysAfter("c", Guid.Empty).Count());
});
}
示例8: 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;
}
示例9: 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;
}