コード例 #1
0
        internal void WriteTo(Span <byte> output)
        {
            var writer = new SpanWriter <byte>(output);

            BinaryPrimitives.WriteInt64LittleEndian(writer.Slide(sizeof(long)), ApplicationId);
            BinaryPrimitives.WriteInt64LittleEndian(writer.Slide(sizeof(long)), StreamId);
        }
コード例 #2
0
        private int CreateOutboundMessage(Span <byte> payload)
        {
            var writer = new SpanWriter <byte>(payload);

            WriteUInt16LittleEndian(writer.Slide(sizeof(ushort)), myPort);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), currentTerm);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), lastLogIndex);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), lastLogTerm);

            return(writer.WrittenCount);
        }
コード例 #3
0
ファイル: SnapshotExchange.cs プロジェクト: scharnyw/dotNext
        private int WriteAnnouncement(Span <byte> output)
        {
            var writer = new SpanWriter <byte>(output);

            WriteUInt16LittleEndian(writer.Slide(sizeof(ushort)), myPort);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), term);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), snapshotIndex);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), snapshot.Length.GetValueOrDefault(-1));
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), snapshot.Term);
            writer.Write(snapshot.Timestamp);

            return(writer.WrittenCount);
        }
コード例 #4
0
ファイル: EntriesExchange.cs プロジェクト: scharnyw/dotNext
        private protected int WriteAnnouncement(Span <byte> output, int entriesCount)
        {
            var writer = new SpanWriter <byte>(output);

            WriteUInt16LittleEndian(writer.Slide(sizeof(ushort)), myPort);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), term);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), prevLogIndex);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), prevLogTerm);
            WriteInt64LittleEndian(writer.Slide(sizeof(long)), commitIndex);
            WriteInt32LittleEndian(writer.Slide(sizeof(int)), entriesCount);

            return(writer.WrittenCount);
        }