Example #1
0
 public PrefixedSlice()
 {
     Options = SliceOptions.Key;
     Size = 0;
     KeyLength = 0;
     Header = new PrefixedSliceHeader();
     NonPrefixedData = new Slice(SliceOptions.Key);
 }
Example #2
0
 public PrefixedSlice()
 {
     Options         = SliceOptions.Key;
     Size            = 0;
     KeyLength       = 0;
     Header          = new PrefixedSliceHeader();
     NonPrefixedData = new Slice(SliceOptions.Key);
 }
Example #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;
        }
Example #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;
        }
Example #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;
        }
Example #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;
        }
Example #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;
            }
        }
Example #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;
		}
Example #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;
            }
        }
Example #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;
        }