Esempio n. 1
0
        public unsafe void WriteObject(BinSerializer bs)
        {
            bs.Write(WaitHandle.ToInt64());
            bs.Write(Require.RaftGroupId);
            bs.Write(Require.DataCF);
            bs.Write(Require.Skip);
            bs.Write(Require.Take);
            bs.Write(Require.ToIndexTarget);

            bs.Write(Require.BeginKeySize.ToInt32());
            var span = new ReadOnlySpan <byte>(Require.BeginKeyPtr.ToPointer(), Require.BeginKeySize.ToInt32());

            bs.Stream.Write(span);

            bs.Write(Require.EndKeySize.ToInt32());
            if (Require.EndKeyPtr != IntPtr.Zero)
            {
                span = new ReadOnlySpan <byte>(Require.EndKeyPtr.ToPointer(), Require.EndKeySize.ToInt32());
                bs.Stream.Write(span);
            }

            var filterSize = Require.FilterPtr == IntPtr.Zero ? 0 : NativeBytes.GetSize(Require.FilterPtr);

            bs.Write(filterSize);
            if (filterSize > 0)
            {
                span = new ReadOnlySpan <byte>((Require.FilterPtr + 4).ToPointer(), filterSize);
                bs.Stream.Write(span);
            }
        }
Esempio n. 2
0
        public unsafe void WriteObject(BinSerializer bs)
        {
            bs.Write(WaitHandle.ToInt64());
            bs.Write(TxnPtr.ToInt64());
            bs.Write(Require.RaftGroupId);
            bs.Write(Require.SchemaVersion);
            bs.Write((byte)Require.DataCF);
            bs.Write(Require.Merge);
            bs.Write(Require.ReturnExists);

            bs.Write(Require.KeySize.ToInt32());
            var span = new ReadOnlySpan <byte>(Require.KeyPtr.ToPointer(), Require.KeySize.ToInt32());

            bs.Stream.Write(span);

            bs.Write(Require.RefsSize.ToInt32());
            if (Require.RefsSize.ToInt32() > 0)
            {
                span = new ReadOnlySpan <byte>(Require.RefsPtr.ToPointer(), Require.RefsSize.ToInt32());
                bs.Stream.Write(span);
            }

            int dataSize = NativeBytes.GetSize(Require.DataPtr);

            bs.Write(dataSize);
            span = new ReadOnlySpan <byte>((Require.DataPtr + 4).ToPointer(), dataSize);
            bs.Stream.Write(span);
        }
Esempio n. 3
0
        private unsafe void ReadReadIndexByGetRes(BinSerializer bs)
        {
            Data1 = new IntPtr(bs.ReadInt64());
            int size = bs.ReadInt32();

            if (size > 0)
            {
                IntPtr rawPtr   = NativeBytes.MakeRaw(size);
                var    dataSpan = new Span <byte>((rawPtr + 4).ToPointer(), size);
                bs.Stream.Read(dataSpan);
                Data2 = rawPtr;
            }
        }