public unsafe VarLenHeapContainer(ref T obj, IVariableLengthStruct <T> varLenStruct, SectorAlignedBufferPool pool)
        {
            var len = varLenStruct.GetLength(ref obj);

            mem = pool.Get(len);
            Buffer.MemoryCopy(Unsafe.AsPointer(ref obj), mem.GetValidPointer(), len, len);
        }
Example #2
0
        public unsafe VarLenHeapContainer(ref T obj, IVariableLengthStruct <T> varLenStruct, SectorAlignedBufferPool pool)
        {
            this.varLenStruct = varLenStruct;
            var len = varLenStruct.GetLength(ref obj);

            mem = pool.Get(len);
            varLenStruct.Serialize(ref obj, mem.GetValidPointer());
        }
        public bool CopyInPlace(ref Value src, ref Value dst, IVariableLengthStruct <Value> valueLength)
        {
            var srcLength = valueLength.GetLength(ref src);
            var dstLength = valueLength.GetLength(ref dst);

            if (srcLength != dstLength)
            {
                return(false);
            }

            Buffer.MemoryCopy(
                Unsafe.AsPointer(ref src),
                Unsafe.AsPointer(ref dst),
                dstLength,
                srcLength);

            return(true);
        }
        public void Copy(ref Value src, ref Value dst, IVariableLengthStruct <Value> valueLength)
        {
            var srcLength = valueLength.GetLength(ref src);

            Buffer.MemoryCopy(
                Unsafe.AsPointer(ref src),
                Unsafe.AsPointer(ref dst),
                srcLength,
                srcLength);
        }
Example #5
0
 private int ValueSize(long physicalAddress)
 {
     return(ValueLength.GetLength(ref GetValue(physicalAddress)));
 }
Example #6
0
 private int KeySize(long physicalAddress)
 {
     return(KeyLength.GetLength(ref GetKey(physicalAddress)));
 }
 public int GetLength(ref T t, ref Input input)
 {
     return(variableLengthStruct.GetLength(ref t));
 }
        private int AlignedKeySize(long physicalAddress)
        {
            int len = KeyLength.GetLength(ref GetKey(physicalAddress));

            return((len + kRecordAlignment - 1) & (~(kRecordAlignment - 1)));
        }