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