Ejemplo 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);
            }
        }
Ejemplo 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);
        }