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


C# ITransactionalStorage类代码示例

本文整理汇总了C#中ITransactionalStorage的典型用法代码示例。如果您正苦于以下问题:C# ITransactionalStorage类的具体用法?C# ITransactionalStorage怎么用?C# ITransactionalStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITransactionalStorage类属于命名空间,在下文中一共展示了ITransactionalStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
		}
开发者ID:jesuslpm,项目名称:ravendb,代码行数:30,代码来源:RavenFileSystem.cs


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