本文整理汇总了C#中ITransactionalStorage类的典型用法代码示例。如果您正苦于以下问题:C# ITransactionalStorage类的具体用法?C# ITransactionalStorage怎么用?C# ITransactionalStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITransactionalStorage类属于命名空间,在下文中一共展示了ITransactionalStorage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreatingOrOpeningAndWritting
public static SynchronizingFileStream CreatingOrOpeningAndWritting(ITransactionalStorage storage, IndexStorage search,
StorageOperationsTask operationsTask,
string fileName, NameValueCollection metadata)
{
return new SynchronizingFileStream(storage, fileName, StorageStreamAccess.CreateAndWrite, metadata, search,
operationsTask) { PreventUploadComplete = true };
}
开发者ID:randacc,项目名称:ravendb,代码行数:7,代码来源:SynchronizingFileStream.cs
示例2: SynchronizingFileStream
private SynchronizingFileStream(ITransactionalStorage transactionalStorage, string fileName,
StorageStreamAccess storageStreamAccess, NameValueCollection metadata,
IndexStorage indexStorage, StorageOperationsTask operations)
: base(transactionalStorage, fileName, storageStreamAccess, metadata, indexStorage, operations)
{
md5Hasher = new MD5CryptoServiceProvider();
}
开发者ID:randacc,项目名称:ravendb,代码行数:7,代码来源:SynchronizingFileStream.cs
示例3: StorageSignatureRepository
public StorageSignatureRepository(ITransactionalStorage storage, string fileName)
{
_tempDirectory = TempDirectoryTools.Create();
_storage = storage;
_fileName = fileName;
_createdFiles = new Dictionary<string, FileStream>();
}
开发者ID:IdanHaim,项目名称:ravendb,代码行数:7,代码来源:StorageSignatureRepository.cs
示例4: ReadIndexesFromCatalog
private void ReadIndexesFromCatalog(IEnumerable<AbstractViewGenerator> compiledGenerators, ITransactionalStorage transactionalStorage)
{
foreach (var generator in compiledGenerators)
{
var copy = generator;
var displayNameAtt = TypeDescriptor.GetAttributes(copy)
.OfType<DisplayNameAttribute>()
.FirstOrDefault();
var name = displayNameAtt != null ? displayNameAtt.DisplayName : copy.GetType().Name;
transactionalStorage.Batch(actions =>
{
if (actions.Indexing.GetIndexesStats().Any(x => x.Name == name))
return;
actions.Indexing.AddIndex(name, copy.ReduceDefinition != null);
});
var indexDefinition = new IndexDefinition
{
Name = name,
Map = "Compiled map function: " + generator.GetType().AssemblyQualifiedName,
// need to supply this so the index storage will create map/reduce index
Reduce = generator.ReduceDefinition == null ? null : "Compiled reduce function: " + generator.GetType().AssemblyQualifiedName,
Indexes = generator.Indexes,
Stores = generator.Stores,
IsCompiled = true
};
indexCache.AddOrUpdate(name, copy, (s, viewGenerator) => copy);
indexDefinitions.AddOrUpdate(name, indexDefinition, (s1, definition) => indexDefinition);
}
}
开发者ID:remcoros,项目名称:ravendb,代码行数:33,代码来源:IndexDefinitionStorage.cs
示例5: 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"));
});
}
开发者ID:nzdunic,项目名称:ravendb,代码行数:25,代码来源:ReduceStaleness.cs
示例6: StorageStream
protected StorageStream(ITransactionalStorage transactionalStorage, string fileName,
StorageStreamAccess storageStreamAccess,
RavenJObject metadata, IndexStorage indexStorage, StorageOperationsTask operations)
{
TransactionalStorage = transactionalStorage;
StorageStreamAccess = storageStreamAccess;
Name = fileName;
switch (storageStreamAccess)
{
case StorageStreamAccess.Read:
TransactionalStorage.Batch(accessor => fileHeader = accessor.ReadFile(fileName));
if (fileHeader.TotalSize == null)
{
throw new FileNotFoundException("File is not uploaded yet");
}
Metadata = fileHeader.Metadata;
Seek(0, SeekOrigin.Begin);
break;
case StorageStreamAccess.CreateAndWrite:
TransactionalStorage.Batch(accessor =>
{
operations.IndicateFileToDelete(fileName);
accessor.PutFile(fileName, null, metadata);
indexStorage.Index(fileName, metadata);
});
Metadata = metadata;
break;
default:
throw new ArgumentOutOfRangeException("storageStreamAccess", storageStreamAccess, "Unknown value");
}
}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:32,代码来源:StorageStream.cs
示例7: EtagSynchronizer
public EtagSynchronizer(EtagSynchronizerType type, ITransactionalStorage transactionalStorage)
{
this.type = type;
this.transactionalStorage = transactionalStorage;
LoadSynchronizationState();
}
开发者ID:robashton,项目名称:ravendb,代码行数:7,代码来源:EtagSynchronizer.cs
示例8: LocalRdcManager
public LocalRdcManager(ISignatureRepository signatureRepository, ITransactionalStorage transactionalStorage,
SigGenerator sigGenerator)
{
_signatureRepository = signatureRepository;
_transactionalStorage = transactionalStorage;
_sigGenerator = sigGenerator;
}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:7,代码来源:LocalRdcManager.cs
示例9: AbstractIndexingExecuter
protected AbstractIndexingExecuter(
ITransactionalStorage transactionalStorage, WorkContext context, TaskScheduler scheduler)
{
this.transactionalStorage = transactionalStorage;
this.context = context;
this.scheduler = scheduler;
}
开发者ID:shiranGinige,项目名称:ravendb,代码行数:7,代码来源:AbstractIndexingExecuter.cs
示例10: SynchronizingFileStream
private SynchronizingFileStream(ITransactionalStorage transactionalStorage, string fileName,
StorageStreamAccess storageStreamAccess, RavenJObject metadata,
IndexStorage indexStorage, StorageOperationsTask operations)
: base(transactionalStorage, fileName, storageStreamAccess, metadata, indexStorage, operations)
{
md5Hasher = Encryptor.Current.CreateHash();
}
开发者ID:cocytus,项目名称:ravendb,代码行数:7,代码来源:SynchronizingFileStream.cs
示例11: IndexDefinitionStorage
public IndexDefinitionStorage(
ITransactionalStorage transactionalStorage,
string path,
IEnumerable<AbstractViewGenerator> compiledGenerators,
AbstractDynamicCompilationExtension[] extensions)
{
this.extensions = extensions;// this is used later in the ctor, so it must appears first
this.path = Path.Combine(path, IndexDefDir);
if (Directory.Exists(this.path) == false)
Directory.CreateDirectory(this.path);
this.extensions = extensions;
foreach (var index in Directory.GetFiles(this.path, "*.index"))
{
try
{
AddAndCompileIndex(
MonoHttpUtility.UrlDecode(Path.GetFileNameWithoutExtension(index)),
JsonConvert.DeserializeObject<IndexDefinition>(File.ReadAllText(index), new JsonEnumConverter())
);
}
catch (Exception e)
{
logger.Warn("Could not compile index " + index + ", skipping bad index", e);
}
}
//compiled view generators always overwrite dynamic views
foreach (var generator in compiledGenerators)
{
var copy = generator;
var displayNameAtt = TypeDescriptor.GetAttributes(copy)
.OfType<DisplayNameAttribute>()
.FirstOrDefault();
var name = displayNameAtt != null ? displayNameAtt.DisplayName : copy.GetType().Name;
transactionalStorage.Batch(actions =>
{
if (actions.Indexing.GetIndexesStats().Any(x => x.Name == name))
return;
actions.Indexing.AddIndex(name);
});
var indexDefinition = new IndexDefinition
{
Map = "Compiled map function: " + generator.GetType().AssemblyQualifiedName,
// need to supply this so the index storage will create map/reduce index
Reduce = generator.ReduceDefinition == null ? null : "Compiled reduce function: " + generator.GetType().AssemblyQualifiedName,
Indexes = generator.Indexes,
Stores = generator.Stores,
IsCompiled = true
};
indexCache.AddOrUpdate(name, copy, (s, viewGenerator) => copy);
indexDefinitions.AddOrUpdate(name, indexDefinition, (s1, definition) => indexDefinition);
}
}
开发者ID:ajaishankar,项目名称:ravendb,代码行数:59,代码来源:IndexDefinitionStorage.cs
示例12: TimeoutExceeded
public bool TimeoutExceeded(string fileName, ITransactionalStorage storage)
{
var result = false;
storage.Batch(accessor => result = TimeoutExceeded(fileName, accessor));
return result;
}
开发者ID:IdanHaim,项目名称:ravendb,代码行数:8,代码来源:FileLockManager.cs
示例13: StorageOperationsTask
public StorageOperationsTask(ITransactionalStorage storage, IndexStorage search, INotificationPublisher notificationPublisher)
{
this.storage = storage;
this.search = search;
this.notificationPublisher = notificationPublisher;
InitializeTimer();
}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:8,代码来源:StorageOperationsTask.cs
示例14: GetOrDefault
public static SynchronizationConfig GetOrDefault(ITransactionalStorage storage)
{
SynchronizationConfig result = null;
storage.Batch(accessor => result = GetOrDefault(accessor));
return result ?? new SynchronizationConfig();
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:8,代码来源:SynchronizationConfigAccessor.cs
示例15: StorageOperationsTask
public StorageOperationsTask(ITransactionalStorage storage, OrderedPartCollection<AbstractFileDeleteTrigger> deleteTriggers, IndexStorage search, INotificationPublisher notificationPublisher)
{
this.storage = storage;
this.deleteTriggers = deleteTriggers;
this.search = search;
this.notificationPublisher = notificationPublisher;
InitializeTimer();
}
开发者ID:felipeleusin,项目名称:ravendb,代码行数:9,代码来源:StorageOperationsTask.cs
示例16: SynchronizationTask
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);
}
开发者ID:knives-out,项目名称:ravendb,代码行数:10,代码来源:SynchronizationTask.cs
示例17: ReadFileToDatabase
public ReadFileToDatabase(BufferPool bufferPool, ITransactionalStorage storage, OrderedPartCollection<AbstractFilePutTrigger> putTriggers, Stream inputStream, string filename, RavenJObject headers)
{
this.bufferPool = bufferPool;
this.inputStream = inputStream;
this.storage = storage;
this.putTriggers = putTriggers;
this.filename = filename;
this.headers = headers;
buffer = bufferPool.TakeBuffer(StorageConstants.MaxPageSize);
md5Hasher = Encryptor.Current.CreateHash();
}
开发者ID:j2jensen,项目名称:ravendb,代码行数:11,代码来源:ReadFileToDatabase.cs
示例18: SynchronizationTask
public SynchronizationTask(ITransactionalStorage storage, SigGenerator sigGenerator, NotificationPublisher publisher,
InMemoryRavenConfiguration systemConfiguration)
{
this.storage = storage;
this.publisher = publisher;
this.systemConfiguration = systemConfiguration;
synchronizationQueue = new SynchronizationQueue();
synchronizationStrategy = new SynchronizationStrategy(storage, sigGenerator);
LastSuccessfulSynchronizationTime = DateTime.MinValue;
InitializeTimer();
}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:13,代码来源:SynchronizationTask.cs
示例19: SynchronizationWorkItem
protected SynchronizationWorkItem(string fileName, string sourceServerUrl, ITransactionalStorage storage)
{
Storage = storage;
FileName = fileName;
FileAndPagesInformation fileAndPages = null;
Storage.Batch(accessor => fileAndPages = accessor.GetFile(fileName, 0, 0));
FileMetadata = fileAndPages.Metadata;
FileSystemInfo = new FileSystemInfo
{
Id = Storage.Id,
Url = sourceServerUrl
};
conflictDetector = new ConflictDetector();
conflictResolver = new ConflictResolver(null, null);
}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:17,代码来源:SynchronizationWorkItem.cs
示例20: IndexDefinitionStorage
public IndexDefinitionStorage(
InMemoryRavenConfiguration configuration,
ITransactionalStorage transactionalStorage,
string path,
OrderedPartCollection<AbstractDynamicCompilationExtension> extensions)
{
this.configuration = configuration;
this.transactionalStorage = transactionalStorage;
this.extensions = extensions; // this is used later in the ctor, so it must appears first
this.path = Path.Combine(path, IndexDefDir);
if (Directory.Exists(this.path) == false && configuration.RunInMemory == false)
Directory.CreateDirectory(this.path);
if (configuration.RunInMemory == false)
ReadFromDisk();
newDefinitionsThisSession.Clear();
}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:19,代码来源:IndexDefinitionStorage.cs
注:本文中的ITransactionalStorage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论