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