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


C# StorageEnvironmentOptions类代码示例

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


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

示例1: TableStorage

		public TableStorage(StorageEnvironmentOptions options, IBufferPool bufferPool)
		{
            if (options == null)
                throw new ArgumentNullException("options");

		    _options = options;
		    this.bufferPool = bufferPool;

            Debug.Assert(options != null);

//#if DEBUG
//			var directoryOptions = options as StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions;
//
//			string debugJournalName;
//			if (directoryOptions != null)
//				debugJournalName = directoryOptions.TempPath.Replace(Path.DirectorySeparatorChar, '_').Replace(':','_');
//			else
//				debugJournalName = "InMemoryDebugJournal-" + Interlocked.Increment(ref debugJournalCount);
//
//			env = new StorageEnvironment(options, debugJournalName) {IsDebugRecording = true};
//#else
			env = new StorageEnvironment(options);
//#endif
			Initialize();
		}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:25,代码来源:TableStorage.cs

示例2: Configure

		protected override void Configure(StorageEnvironmentOptions options)
		{
			options.MaxLogFileSize = 10 * AbstractPager.PageSize;
			options.OnRecoveryError += (sender, args) => { }; // just shut it up
			options.ManualFlushing = true;
			options.MaxScratchBufferSize = 1 * 1024 * 1024 * 1024;
		}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:7,代码来源:RecoveryMultipleJournals.cs

示例3: Execute

		public static void Execute(StorageEnvironmentOptions srcOptions, StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions compactOptions, Action<CompactionProgress> progressReport = null)
		{
			if (srcOptions.IncrementalBackupEnabled)
				throw new InvalidOperationException(CannotCompactBecauseOfIncrementalBackup);

			long minimalCompactedDataFileSize;

			srcOptions.ManualFlushing = true; // prevent from flushing during compaction - we shouldn't touch any source files
			compactOptions.ManualFlushing = true; // let us flush manually during data copy

			using(var existingEnv = new StorageEnvironment(srcOptions))
			using (var compactedEnv = new StorageEnvironment(compactOptions))
			{
				CopyTrees(existingEnv, compactedEnv, progressReport);

				compactedEnv.FlushLogToDataFile(allowToFlushOverwrittenPages: true);

				compactedEnv.Journal.Applicator.SyncDataFile(compactedEnv.OldestTransaction);
				compactedEnv.Journal.Applicator.DeleteCurrentAlreadyFlushedJournal();

				minimalCompactedDataFileSize = compactedEnv.NextPageNumber*AbstractPager.PageSize;
			}

			using (var compactedDataFile = new FileStream(Path.Combine(compactOptions.BasePath, Constants.DatabaseFilename), FileMode.Open, FileAccess.ReadWrite))
			{
				compactedDataFile.SetLength(minimalCompactedDataFileSize);
			}
		}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:28,代码来源:StorageCompaction.cs

示例4: ModifyOptions

		protected StorageEnvironmentOptions ModifyOptions(StorageEnvironmentOptions options)
		{
			options.MaxLogFileSize = 1000 * AbstractPager.PageSize;
			options.IncrementalBackupEnabled = true;
			options.ManualFlushing = true;

			return options;
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:8,代码来源:RavenDB_3115.cs

示例5: RequireFileBasedPager

	    protected void RequireFileBasedPager()
	    {
	        if(_storageEnvironment != null)
                throw new InvalidOperationException("Too late");
            if (_options is StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions)
	            return;
            DeleteDirectory("test.data");
            _options = StorageEnvironmentOptions.ForPath("test.data");
            Configure(_options);
	    }
开发者ID:randacc,项目名称:ravendb,代码行数:10,代码来源:StorageTest.cs

示例6: Restore

 public void Restore(StorageEnvironmentOptions options, IEnumerable<string> backupPaths)
 {
     var ownsPagers = options.OwnsPagers;
     options.OwnsPagers = false;
     using (var env = new StorageEnvironment(options))
     {
         foreach (var backupPath in backupPaths)
         {
             Restore(env, backupPath);
         }
     }
     options.OwnsPagers = ownsPagers;
 }
开发者ID:jesuslpm,项目名称:ravendb,代码行数:13,代码来源:IncrementalBackup.cs

示例7: TableStorage

		public TableStorage(StorageEnvironmentOptions options, IBufferPool bufferPool)
		{
            if (options == null)
                throw new ArgumentNullException("options");

		    _options = options;
		    this.bufferPool = bufferPool;

            Debug.Assert(options != null);
            env = new StorageEnvironment(options);

			Initialize();
		}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:13,代码来源:TableStorage.cs

示例8: CopyHeaders

        internal static void CopyHeaders(CompressionLevel compression, ZipArchive package, DataCopier copier, StorageEnvironmentOptions storageEnvironmentOptions)
        {
            foreach (var headerFileName in HeaderAccessor.HeaderFileNames)
            {
                var header = stackalloc FileHeader[1];

                if (!storageEnvironmentOptions.ReadHeader(headerFileName, header))
                    continue;

                var headerPart = package.CreateEntry(headerFileName, compression);
                Debug.Assert(headerPart != null);

                using (var headerStream = headerPart.Open())
                {
                    copier.ToStream((byte*)header, sizeof(FileHeader), headerStream);
                }
            }
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:18,代码来源:VoronBackupUtil.cs

示例9: ReadOneTransaction

		public bool ReadOneTransaction(StorageEnvironmentOptions options, bool checkCrc = true)
		{
			if (_readingPage >= _pager.NumberOfAllocatedPages)
				return false;

			if (MaxPageToRead != null && _readingPage >= MaxPageToRead.Value)
				return false;

			TransactionHeader* current;
			if (!TryReadAndValidateHeader(options, out current))
				return false;

			var transactionSize = GetNumberOfPagesFromSize(current->Compressed ? current->CompressedSize : current->UncompressedSize);

			if (current->TransactionId <= _lastSyncedTransactionId)
			{
				LastTransactionHeader = current;
				_readingPage += transactionSize;
				return true; // skipping
			}

			if (checkCrc && !ValidatePagesCrc(options, transactionSize, current))
				return false;

			_recoveryPager.EnsureContinuous(null, _recoveryPage, (current->PageCount + current->OverflowPageCount) + 1);
			var dataPage = _recoveryPager.AcquirePagePointer(_recoveryPage);

			UnmanagedMemory.Set(dataPage, 0, (current->PageCount + current->OverflowPageCount) * AbstractPager.PageSize);
			if (current->Compressed)
			{
				if (TryDecompressTransactionPages(options, current, dataPage) == false)
					return false;
			}
			else
			{
                Memory.Copy(dataPage, _pager.AcquirePagePointer(_readingPage), (current->PageCount + current->OverflowPageCount) * AbstractPager.PageSize);
			}

			var tempTransactionPageTranslaction = new Dictionary<long, RecoveryPagePosition>();

			for (var i = 0; i < current->PageCount; i++)
			{
				Debug.Assert(_pager.Disposed == false);
				Debug.Assert(_recoveryPager.Disposed == false);

				var page = _recoveryPager.Read(_recoveryPage);

				var pagePosition = new RecoveryPagePosition
				{
					JournalPos = _recoveryPage,
					TransactionId = current->TransactionId
				};

				if (page.IsOverflow)
				{
					var numOfPages = _recoveryPager.GetNumberOfOverflowPages(page.OverflowSize);

					pagePosition.IsOverflow = true;
					pagePosition.NumberOfOverflowPages = numOfPages;

					_recoveryPage += numOfPages;
				}
				else
				{
					_recoveryPage++;
				}

				tempTransactionPageTranslaction[page.PageNumber] = pagePosition;
			}

			_readingPage += transactionSize;

			LastTransactionHeader = current;

			foreach (var pagePosition in tempTransactionPageTranslaction)
			{
				_transactionPageTranslation[pagePosition.Key] = pagePosition.Value;

				if (pagePosition.Value.IsOverflow)
				{
					Debug.Assert(pagePosition.Value.NumberOfOverflowPages != -1);

					for (int i = 1; i < pagePosition.Value.NumberOfOverflowPages; i++)
					{
						_transactionPageTranslation.Remove(pagePosition.Key + i);
					}
				}
			}

			return true;
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:91,代码来源:JournalReader.cs

示例10: StorageTest

		protected StorageTest()
		{
			DeleteDirectory("test.data");
		    _options = StorageEnvironmentOptions.CreateMemoryOnly();
			Configure(_options);
		}
开发者ID:randacc,项目名称:ravendb,代码行数:6,代码来源:StorageTest.cs

示例11: Configure

		protected virtual void Configure(StorageEnvironmentOptions options)
		{

		}
开发者ID:randacc,项目名称:ravendb,代码行数:4,代码来源:StorageTest.cs

示例12: Configure

 protected override void Configure(StorageEnvironmentOptions options)
 {
     options.MaxScratchBufferSize = 1024*1024*12; // 2048 pages
     options.MaxNumberOfPagesInJournalBeforeFlush = 96;
     options.ManualFlushing = true;
 }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:6,代码来源:MutipleScratchBuffersUsage.cs

示例13: ReadOneTransaction

        public bool ReadOneTransaction(StorageEnvironmentOptions options,bool checkCrc = true)
        {
            if (_readingPage >= _pager.NumberOfAllocatedPages)
                return false;

            TransactionHeader* current;
            if (!TryReadAndValidateHeader(options, out current))
                return false;

            var compressedPages = (current->CompressedSize / AbstractPager.PageSize) + (current->CompressedSize % AbstractPager.PageSize == 0 ? 0 : 1);

            if (current->TransactionId <= _lastSyncedTransactionId)
            {
                LastTransactionHeader = current;
                _readingPage += compressedPages;
                return true; // skipping
            }

            if (checkCrc && !ValidatePagesCrc(options, compressedPages, current))
                return false;

            _recoveryPager.EnsureContinuous(null, _recoveryPage, (current->PageCount + current->OverflowPageCount) + 1);
            var dataPage = _recoveryPager.AcquirePagePointer(_recoveryPage);

            NativeMethods.memset(dataPage, 0, (current->PageCount + current->OverflowPageCount) * AbstractPager.PageSize);
            try
            {
                LZ4.Decode64(_pager.AcquirePagePointer(_readingPage), current->CompressedSize, dataPage, current->UncompressedSize, true);
            }
            catch (Exception e)
            {
                options.InvokeRecoveryError(this, "Could not de-compress, invalid data", e);
                RequireHeaderUpdate = true;

                return false;
            }

            var tempTransactionPageTranslaction = new Dictionary<long, JournalFile.PagePosition>();

            for (var i = 0; i < current->PageCount; i++)
            {
                Debug.Assert(_pager.Disposed == false);
                Debug.Assert(_recoveryPager.Disposed == false);

                var page = _recoveryPager.Read(_recoveryPage);

                 tempTransactionPageTranslaction[page.PageNumber] = new JournalFile.PagePosition
                {
                    JournalPos = _recoveryPage,
                    TransactionId = current->TransactionId
                };

                if (page.IsOverflow)
                {
                    var numOfPages = _recoveryPager.GetNumberOfOverflowPages(page.OverflowSize);
                    _recoveryPage += numOfPages;
                }
                else
                {
                    _recoveryPage++;
                }
            }

            _readingPage += compressedPages;

            LastTransactionHeader = current;

            foreach (var pagePosition in tempTransactionPageTranslaction)
            {
                _transactionPageTranslation[pagePosition.Key] = pagePosition.Value;
            }

            return true;
        }
开发者ID:jesuslpm,项目名称:ravendb,代码行数:74,代码来源:JournalReader.cs

示例14: Configure

 protected override void Configure(StorageEnvironmentOptions options)
 {
     options.MaxScratchBufferSize = 1024*1024*1;
     options.ManualFlushing = true;
 }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:5,代码来源:RavenDB_2850.cs

示例15: Configure

		// all tests here relay on the fact than one log file can contains max 10 pages
		protected override void Configure(StorageEnvironmentOptions options)
		{
			options.MaxLogFileSize = 10 * AbstractPager.PageSize;
		}
开发者ID:randacc,项目名称:ravendb,代码行数:5,代码来源:EdgeCases.cs


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