Ejemplo n.º 1
0
 public PrefixedSlice()
 {
     Options = SliceOptions.Key;
     Size = 0;
     KeyLength = 0;
     Header = new PrefixedSliceHeader();
     NonPrefixedData = new Slice(SliceOptions.Key);
 }
Ejemplo n.º 2
0
 public PrefixedSlice()
 {
     Options         = SliceOptions.Key;
     Size            = 0;
     KeyLength       = 0;
     Header          = new PrefixedSliceHeader();
     NonPrefixedData = new Slice(SliceOptions.Key);
 }
Ejemplo n.º 3
0
        public PrefixedSlice(byte prefixId, ushort prefixUsage, Slice nonPrefixedValue)
        {
            Header = new PrefixedSliceHeader
            {
                PrefixId            = prefixId,
                PrefixUsage         = prefixUsage,
                NonPrefixedDataSize = nonPrefixedValue.KeyLength
            };

            NonPrefixedData = nonPrefixedValue;
            Size            = (ushort)(Constants.PrefixedSliceHeaderSize + nonPrefixedValue.KeyLength);
            KeyLength       = (ushort)(prefixUsage + nonPrefixedValue.KeyLength);
            Options         = nonPrefixedValue.Options;
        }
Ejemplo n.º 4
0
        public PrefixedSlice(byte prefixId, ushort prefixUsage, Slice nonPrefixedValue)
        {
            Header = new PrefixedSliceHeader
            {
                PrefixId = prefixId,
                PrefixUsage = prefixUsage,
                NonPrefixedDataSize = nonPrefixedValue.KeyLength
            };

            NonPrefixedData = nonPrefixedValue;
            Size = (ushort)(Constants.PrefixedSliceHeaderSize + nonPrefixedValue.KeyLength);
            KeyLength = (ushort)(prefixUsage + nonPrefixedValue.KeyLength);
            Options = nonPrefixedValue.Options;
        }
Ejemplo n.º 5
0
        public PrefixedSlice(MemorySlice key)
        {
            Header = new PrefixedSliceHeader
            {
                PrefixId            = NonPrefixedId,
                PrefixUsage         = 0,
                NonPrefixedDataSize = key.KeyLength
            };

            NonPrefixedData = key.ToSlice();

            Size      = (ushort)(Constants.PrefixedSliceHeaderSize + key.KeyLength);
            KeyLength = key.KeyLength;
            Options   = SliceOptions.Key;
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        public override void Set(NodeHeader *node)
        {
            Debug.Assert(this != Empty, "Cannot call Set() on PrefixedSlice.Empty");

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

                NonPrefixedData.Set((byte *)prefixHeaderPtr + Constants.PrefixedSliceHeaderSize, Header.NonPrefixedDataSize);

                Size      = node->KeySize;
                KeyLength = (ushort)(Header.PrefixUsage + Header.NonPrefixedDataSize);
            }
            else
            {
                Size      = 0;
                KeyLength = 0;
            }
        }
Ejemplo n.º 8
0
		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;
		}
Ejemplo n.º 9
0
        public override void Set(NodeHeader* node)
        {
            Debug.Assert(this != Empty, "Cannot call Set() on PrefixedSlice.Empty");

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

                NonPrefixedData.Set((byte*)prefixHeaderPtr + Constants.PrefixedSliceHeaderSize, Header.NonPrefixedDataSize);

                Size = node->KeySize;
                KeyLength = (ushort)(Header.PrefixUsage + Header.NonPrefixedDataSize);
            }
            else
            {
                Size = 0;
                KeyLength = 0;
            }
        }
Ejemplo n.º 10
0
        public PrefixedSlice(MemorySlice key)
        {
            Header = new PrefixedSliceHeader
            {
                PrefixId = NonPrefixedId,
                PrefixUsage = 0,
                NonPrefixedDataSize = key.KeyLength
            };

            NonPrefixedData = key.ToSlice();

            Size = (ushort)(Constants.PrefixedSliceHeaderSize + key.KeyLength);
            KeyLength = key.KeyLength;
            Options = SliceOptions.Key;
        }