• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Trees.NodeHeader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetInline

 public static void SetInline(Slice slice, NodeHeader* node)
 {
     slice.Pointer = (byte*)node + Constants.NodeHeaderSize;
     slice.Size = node->KeySize;
     slice.KeyLength = node->KeySize;
     slice.Array = null;
 }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:7,代码来源:Slice.cs


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: NodeEntry

        public static int NodeEntry(NodeHeader* other)
        {
            var sz = other->KeySize + Constants.NodeHeaderSize;
            if (other->Flags == NodeFlags.Data || other->Flags == NodeFlags.MultiValuePageRef)
                sz += other->DataSize;

            sz += sz & 1;

            return sz;
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:10,代码来源:SizeOf.cs


示例7: GetData

 public static Slice GetData(Transaction tx, NodeHeader* node)
 {
     if (node->Flags == (NodeFlags.PageRef))
     {
         var overFlowPage = tx.GetReadOnlyPage(node->PageNumber);
         if (overFlowPage.OverflowSize > ushort.MaxValue)
             throw new InvalidOperationException("Cannot convert big data to a slice, too big");
         return new Slice(overFlowPage.Base + Constants.PageHeaderSize, (ushort)overFlowPage.OverflowSize);
     }
     return new Slice((byte*)node + node->KeySize + Constants.NodeHeaderSize, (ushort) node->DataSize);
 }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:11,代码来源:NodeHeader.cs


示例8: NodeEntryWithAnotherKey

        public static int NodeEntryWithAnotherKey(NodeHeader* other, Slice key)
        {
            var keySize = key == null ? other->KeySize : key.Size;
            var sz = keySize + Constants.NodeHeaderSize;
            if (other->Flags == NodeFlags.Data || other->Flags == NodeFlags.MultiValuePageRef)
                sz += other->DataSize;

            sz += sz & 1;

            return sz;
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:11,代码来源:SizeOf.cs


示例9: Reader

        public static ValueReader Reader(Transaction tx, NodeHeader* node)
        {
            if (node->Flags == (NodeFlags.PageRef))
            {
                var overFlowPage = tx.GetReadOnlyPage(node->PageNumber);

                Debug.Assert(overFlowPage.IsOverflow, "Requested oveflow page but got " + overFlowPage.Flags);
                Debug.Assert(overFlowPage.OverflowSize > 0, "Overflow page cannot be size equal 0 bytes");

                return new ValueReader(overFlowPage.Base + Constants.PageHeaderSize, overFlowPage.OverflowSize);
            }
            return new ValueReader((byte*)node + node->KeySize + Constants.NodeHeaderSize, node->DataSize);
        }
开发者ID:mattwarren,项目名称:LinqToMemory,代码行数:13,代码来源:NodeHeader.cs


示例10: PrefixedSlice

		public PrefixedSlice(NodeHeader* node)
		{
			if (node->KeySize > 0)
			{
				var prefixHeaderPtr = (PrefixedSliceHeader*)((byte*)node + Constants.NodeHeaderSize);
				Header = *prefixHeaderPtr;

				NonPrefixedData = new Slice((byte*)prefixHeaderPtr + Constants.PrefixedSliceHeaderSize, Header.NonPrefixedDataSize);

				Size = node->KeySize;
				KeyLength = (ushort) (Header.PrefixUsage + Header.NonPrefixedDataSize);
			}
			else
			{
				Size = 0;
				KeyLength = 0;
			}

			Options = SliceOptions.Key;
		}
开发者ID:cocytus,项目名称:ravendb,代码行数:20,代码来源:PrefixedSlice.cs


示例11: Set

		public void Set(NodeHeader* node)
		{
			Set((byte*)node + Constants.NodeHeaderSize, node->KeySize);
		}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:4,代码来源:Slice.cs


示例12: ValidateCurrentKey

		public unsafe static bool ValidateCurrentKey(this IIterator self, NodeHeader* node)
		{
			if (self.RequiredPrefix != null)
			{
				var currentKey = new Slice(node);
				if (currentKey.StartsWith(self.RequiredPrefix) == false)
					return false;
			}
			if (self.MaxKey != null)
			{
				var currentKey = new Slice(node);
				if (currentKey.Compare(self.MaxKey) >= 0)
					return false;
			}
			return true;
		}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:16,代码来源:TreeIterator.cs


示例13: GetNodeKey

        public MemorySlice GetNodeKey(NodeHeader* node)
        {
            if (KeysPrefixed == false)
            {
                var keySize = node->KeySize;
                var key = new byte[keySize];

                fixed (byte* ptr = key)
                    Memory.CopyInline(ptr, (byte*)node + Constants.NodeHeaderSize, keySize);

                return new Slice(key);
            }

            if (node->KeySize == 0)
                return new PrefixedSlice(Slice.Empty);

            var prefixHeader = (PrefixedSliceHeader*)((byte*)node + Constants.NodeHeaderSize);

            var nonPrefixedSize = prefixHeader->NonPrefixedDataSize;
            var nonPrefixedData = new byte[nonPrefixedSize];

            fixed (byte* ptr = nonPrefixedData)
                Memory.CopyInline(ptr, (byte*)prefixHeader + Constants.PrefixedSliceHeaderSize, nonPrefixedSize);

            var prefixedSlice = new PrefixedSlice(prefixHeader->PrefixId, prefixHeader->PrefixUsage, new Slice(nonPrefixedData));

            if (prefixHeader->PrefixId == PrefixedSlice.NonPrefixedId)
                return prefixedSlice;

            AssertPrefixNode(prefixedSlice.Header.PrefixId);

            var prefixNodePtr = (PrefixNodeHeader*) (_base + _prefixSection->PrefixOffsets[prefixedSlice.Header.PrefixId]);

            var prefixLength = prefixNodePtr->PrefixLength;
            var prefixData = new byte[prefixLength];

            fixed (byte* ptr = prefixData)
                Memory.CopyInline(ptr, (byte*)prefixNodePtr + Constants.PrefixNodeHeaderSize, prefixLength);

            prefixedSlice.Prefix = new PrefixNode(new PrefixNodeHeader{ PrefixLength =  prefixLength }, prefixData, PageNumber);

            return prefixedSlice;
        }
开发者ID:ricardobrandao,项目名称:ravendb,代码行数:43,代码来源:Page.cs


示例14: SetNodeKey

 // REVIEW: Removed forced inlining for now until we can see if we improve without needing it. 
 // [MethodImpl(MethodImplOptions.AggressiveInlining)]
 public void SetNodeKey(NodeHeader* node, ref MemorySlice sliceInstance)
 {
     if (KeysPrefixed)
     {
         var slice = (PrefixedSlice)sliceInstance;
         SetNodeKey(node, ref slice);
         sliceInstance = slice;
     }                
     else
     {
         Slice slice = (Slice)sliceInstance;
         SetNodeKey(node, ref slice);
         sliceInstance = slice;
     }
 }
开发者ID:ricardobrandao,项目名称:ravendb,代码行数:17,代码来源:Page.cs


示例15: TryOverwriteOverflowPages

		private bool TryOverwriteOverflowPages(Transaction tx, TreeMutableState treeState, NodeHeader* updatedNode,
													  Slice key, int len, ushort? version, out byte* pos)
		{
			if (updatedNode->Flags == NodeFlags.PageRef &&
				tx.Id <= tx.Environment.OldestTransaction) // ensure MVCC - do not overwrite if there is some older active transaction that might read those overflows
			{
				var overflowPage = tx.GetReadOnlyPage(updatedNode->PageNumber);

				if (len <= overflowPage.OverflowSize)
				{
					CheckConcurrency(key, version, updatedNode->Version, TreeActionType.Add);

					if (updatedNode->Version == ushort.MaxValue)
						updatedNode->Version = 0;
					updatedNode->Version++;

					var availableOverflows = tx.DataPager.GetNumberOfOverflowPages(overflowPage.OverflowSize);

					var requestedOverflows = tx.DataPager.GetNumberOfOverflowPages(len);

					var overflowsToFree = availableOverflows - requestedOverflows;

					for (int i = 0; i < overflowsToFree; i++)
					{
						tx.FreePage(overflowPage.PageNumber + requestedOverflows + i);
					}

					treeState.OverflowPages -= overflowsToFree;
					treeState.PageCount -= overflowsToFree;

					overflowPage.OverflowSize = len;

					pos = overflowPage.Base + Constants.PageHeaderSize;
					return true;
				}
			}
			pos = null;
			return false;
		}
开发者ID:paulcbetts,项目名称:ravendb,代码行数:39,代码来源:Tree.cs


示例16: TryOverwriteDataOrMultiValuePageRefNode

		private bool TryOverwriteDataOrMultiValuePageRefNode(NodeHeader* updatedNode, Slice key, int len,
														NodeFlags requestedNodeType, ushort? version,
														out byte* pos)
		{
			switch (requestedNodeType)
			{
				case NodeFlags.Data:
				case NodeFlags.MultiValuePageRef:
					{
						if (updatedNode->DataSize == len &&
							(updatedNode->Flags == NodeFlags.Data || updatedNode->Flags == NodeFlags.MultiValuePageRef))
						{
							CheckConcurrency(key, version, updatedNode->Version, TreeActionType.Add);

							if (updatedNode->Version == ushort.MaxValue)
								updatedNode->Version = 0;
							updatedNode->Version++;

							updatedNode->Flags = requestedNodeType;

							{
								pos = (byte*)updatedNode + Constants.NodeHeaderSize + key.Size;
								return true;
							}
						}
						break;
					}
				case NodeFlags.PageRef:
					throw new InvalidOperationException("We never add PageRef explicitly");
				default:
					throw new ArgumentOutOfRangeException();
			}
			pos = null;
			return false;
		}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:35,代码来源:Tree.MultiTree.cs


示例17: GetNumberOfFreePages

		internal int GetNumberOfFreePages(NodeHeader* node)
		{
			return GetNodeDataSize(node) / Constants.PageNumberSize;
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:4,代码来源:Transaction.cs


示例18: Set

		public override void Set(NodeHeader* node)
		{
            SetInline(this, node);
		}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:4,代码来源:Slice.cs


示例19: Slice

		public Slice(NodeHeader* node)
		{
			Options = SliceOptions.Key;
			Set(node);
		}
开发者ID:felipeleusin,项目名称:ravendb,代码行数:5,代码来源:Slice.cs


示例20: Set

		public override void Set(NodeHeader* node)
		{
			Pointer = (byte*) node + Constants.NodeHeaderSize;
			Size = node->KeySize;
			KeyLength = node->KeySize;
			Array = null;
		}
开发者ID:felipeleusin,项目名称:ravendb,代码行数:7,代码来源:Slice.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Trees.Page类代码示例发布时间:2022-05-26
下一篇:
C# Impl.Transaction类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap