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


C# Impl.Transaction类代码示例

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


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

示例1: Searcher

        public Searcher(FullTextIndex index)
        {
            _index = index;
            _tx = _index.StorageEnvironment.NewTransaction(TransactionFlags.Read);

            _docs = _tx.ReadTree("Docs");
        }
开发者ID:votrongdao,项目名称:Corax,代码行数:7,代码来源:Searcher.cs

示例2: TransactionActivityEntry

 public TransactionActivityEntry(Transaction tx, DebugActionType actionType)
 {
     TransactionId = tx.Id;
     Flags = tx.Flags;
     ActionType = actionType;
     CreatedByJournalApplicator = tx.CreatedByJournalApplicator;
 }
开发者ID:felixmm,项目名称:ravendb,代码行数:7,代码来源:DebugJournal.cs

示例3: TryGetValue

		public bool TryGetValue(Transaction tx, long page, out PagePosition value)
		{
			ImmutableAppendOnlyList<PagePosition> list;
			if (_values.TryGetValue(page, out list) == false)
			{
				value = null;
				return false;
			}
			for (int i = list.Count - 1; i >= 0; i--)
			{
				var it = list[i];

				if (it.TransactionId > tx.Id)
					continue;

				if (it.IsFreedPageMarker)
					break;

				value = it;
				Debug.Assert(value != null);
				return true;
			}

			// all the current values are _after_ this transaction started, so it sees nothing
			value = null;
			return false;
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:27,代码来源:PageTable.cs

示例4: PageSplitter

 public PageSplitter(Transaction tx,
     Tree tree,
     SliceComparer cmp,
     Slice newKey,
     int len,
     long pageNumber,
     NodeFlags nodeType,
     ushort nodeVersion,
     Cursor cursor,
     TreeMutableState treeState)
 {
     _tx = tx;
     _tree = tree;
     _cmp = cmp;
     _newKey = newKey;
     _len = len;
     _pageNumber = pageNumber;
     _nodeType = nodeType;
     _nodeVersion = nodeVersion;
     _cursor = cursor;
     _treeState = treeState;
     Page page = _cursor.Pages.First.Value;
     _page = tx.ModifyPage(page.PageNumber, page);
     _cursor.Pop();
 }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:25,代码来源:PageSplitter.cs

示例5: DumpHumanReadable

 public static void DumpHumanReadable(Transaction tx, long startPageNumber,string filenamePrefix = null)
 {
     if (Debugger.IsAttached == false)
         return;
     var path = Path.Combine(Environment.CurrentDirectory, String.Format("{0}tree.hdump", filenamePrefix ?? String.Empty));
     TreeDumper.DumpHumanReadable(tx, path, tx.GetReadOnlyPage(startPageNumber));
 }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:7,代码来源:DebugStuff.cs

示例6: AllocateMorePages

        public override void AllocateMorePages(Transaction tx, long newLength)
        {
            ThrowObjectDisposedIfNeeded();
            var newLengthAfterAdjustment = NearestSizeToPageSize(newLength);

            if (newLengthAfterAdjustment <= _totalAllocationSize)
                return;

            var allocationSize = newLengthAfterAdjustment - _totalAllocationSize;

            PosixHelper.AllocateFileSpace(_fd, (ulong) (_totalAllocationSize + allocationSize));
            PagerState newPagerState = CreatePagerState();
            if (newPagerState == null)
            {
                var errorMessage = string.Format(
                    "Unable to allocate more pages - unsuccessfully tried to allocate continuous block of virtual memory with size = {0:##,###;;0} bytes",
                    (_totalAllocationSize + allocationSize));

                throw new OutOfMemoryException(errorMessage);
            }

            newPagerState.DebugVerify(newLengthAfterAdjustment);

            if (tx != null)
            {
                tx.EnsurePagerStateReference(newPagerState);
            }

            var tmp = PagerState;
            PagerState = newPagerState;
            tmp.Release(); //replacing the pager state --> so one less reference for it

            _totalAllocationSize += allocationSize;
            NumberOfAllocatedPages = _totalAllocationSize/PageSize;
        }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:35,代码来源:PosixMemoryMapPager.cs

示例7: Initialize

 public void Initialize(FullTextIndex index, Transaction tx, IndexingConventions.ScorerCalc score)
 {
     Index = index;
     Transaction = tx;
     Score = score;
     Init();
 }
开发者ID:josephdecock,项目名称:Corax,代码行数:7,代码来源:Query.cs

示例8: DumpHumanReadable

	    public static void DumpHumanReadable(Transaction tx, string path, Page start)
	    {
		    using (var writer = File.CreateText(path))
		    {
                var stack = new Stack<Page>();
                stack.Push(start);
				writer.WriteLine("Root page #{0}",start.PageNumber);
			    while (stack.Count > 0)
			    {
					var currentPage = stack.Pop();
				    if (currentPage.IsLeaf)
				    {						
						writer.WriteLine();
						writer.WriteLine("Page #{0}, NumberOfEntries = {1}, Flags = {2} (Leaf), Used: {3} : {4}", currentPage.PageNumber,currentPage.NumberOfEntries,currentPage.Flags, currentPage.SizeUsed, currentPage.CalcSizeUsed());
						if(currentPage.NumberOfEntries <= 0)
							writer.WriteLine("Empty page (tree corrupted?)");
					    
						
					    for (int nodeIndex = 0; nodeIndex < currentPage.NumberOfEntries;nodeIndex++)
					    {
						    var node = currentPage.GetNode(nodeIndex);
						    var key = currentPage.GetNodeKey(node);

							writer.WriteLine("Node #{0}, Flags = {1}, {4} = {2}, Key = {3}, Entry Size: {5}", nodeIndex, node->Flags, node->DataSize, MaxString(key.ToString(), 25), node->Flags == NodeFlags.Data ? "Size" : "Page",
                                SizeOf.NodeEntry(node));
					    }
						writer.WriteLine();
				    }
				    else if(currentPage.IsBranch) 
				    {
						writer.WriteLine();
						writer.WriteLine("Page #{0}, NumberOfEntries = {1}, Flags = {2} (Branch), Used: {3} : {4}", currentPage.PageNumber, currentPage.NumberOfEntries, currentPage.Flags, currentPage.SizeUsed, currentPage.SizeUsed);

						var key = new Slice(SliceOptions.Key);
						for (int nodeIndex = 0; nodeIndex < currentPage.NumberOfEntries; nodeIndex++)
						{
							var node = currentPage.GetNode(nodeIndex);
							writer.WriteLine("Node #{2}, {0}  / to page #{1}, Entry Size: {3}", GetBranchNodeString(nodeIndex, key, currentPage, node), node->PageNumber, nodeIndex,
                                SizeOf.NodeEntry(node));
						}

						for (int nodeIndex = 0; nodeIndex < currentPage.NumberOfEntries; nodeIndex++)
						{
							var node = currentPage.GetNode(nodeIndex);
							if (node->PageNumber < 0 || node->PageNumber > tx.State.NextPageNumber)
							{
								writer.Write("Found invalid reference to page #{0}", currentPage.PageNumber);
								stack.Clear();
								break;
							}

							var child = tx.GetReadOnlyPage(node->PageNumber);
							stack.Push(child);
						}
						
						writer.WriteLine();
					}
			    }
		    }
	    }
开发者ID:cocytus,项目名称:ravendb,代码行数:60,代码来源:TreeDumper.cs

示例9: ParentPageAction

 public ParentPageAction(Page parentPage, Page currentPage, Tree tree, Cursor cursor, Transaction tx)
 {
     _parentPage = parentPage;
     _currentPage = currentPage;
     _tree = tree;
     _cursor = cursor;
     _tx = tx;
 }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:8,代码来源:ParentPageAction.cs

示例10: CopyTo

 public static void CopyTo(Transaction tx, NodeHeader* node, byte* dest)
 {
     if (node->Flags == (NodeFlags.PageRef))
     {
         var overFlowPage = tx.GetReadOnlyPage(node->PageNumber);
         Memory.Copy(dest, overFlowPage.Base + Constants.PageHeaderSize, overFlowPage.OverflowSize);
     }
     Memory.Copy(dest, (byte*)node + node->KeySize + Constants.NodeHeaderSize, node->DataSize);
 }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:9,代码来源:NodeHeader.cs

示例11: DirectAccess

 public static byte* DirectAccess(Transaction tx, NodeHeader* node)
 {
     if (node->Flags == (NodeFlags.PageRef))
     {
         var overFlowPage = tx.GetReadOnlyPage(node->PageNumber);
         return overFlowPage.Base + Constants.PageHeaderSize;
     }
     return (byte*) node + node->KeySize + Constants.NodeHeaderSize;
 }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:9,代码来源:NodeHeader.cs

示例12: GetDataSize

 public static int GetDataSize(Transaction tx, NodeHeader* node)
 {
     if (node->Flags == (NodeFlags.PageRef))
     {
         var overFlowPage = tx.GetReadOnlyPage(node->PageNumber);
         return overFlowPage.OverflowSize;
     }
     return node->DataSize;
 }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:9,代码来源:NodeHeader.cs

示例13: Reader

        public unsafe static ValueReader Reader(Transaction tx, NodeHeader* node)
		{
			if (node->Flags == (NodeFlags.PageRef))
			{
				var overFlowPage = tx.GetReadOnlyPage(node->PageNumber);
                return new ValueReader(overFlowPage.Base + Constants.PageHeaderSize, overFlowPage.OverflowSize);
			}
            return new ValueReader((byte*)node + node->KeySize + Constants.NodeHeaderSize, node->DataSize);
		}
开发者ID:randacc,项目名称:ravendb,代码行数:9,代码来源:NodeHeader.cs

示例14: UpdateMaxSeenTxId

		private void UpdateMaxSeenTxId(Transaction tx)
		{
			if (_maxSeenTransaction > tx.Id)
			{
				throw new InvalidOperationException("Transaction ids has to always increment, but got " + tx.Id +
				                                    " when already seen tx " + _maxSeenTransaction);
			}
			_maxSeenTransaction = tx.Id;
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:9,代码来源:PageTable.cs

示例15: Clone

        public StorageEnvironmentState Clone(Transaction tx)
        {
            return new StorageEnvironmentState
                {
					Root = Root != null ? Root.Clone(tx) : null,
					FreeSpaceRoot = FreeSpaceRoot != null ? FreeSpaceRoot.Clone(tx) : null,
                    NextPageNumber = NextPageNumber
                };
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:9,代码来源:StorageEnvironmentState.cs


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