Example #1
0
 public void Read(BinaryReader msg)
 {
     From = msg.ReadIPEndPoint();
     Term = msg.ReadUInt32();
     LastTerm = msg.ReadUInt32();
     LogLength = msg.ReadUInt32();
 }
Example #2
0
        public void Read(BinaryReader msg)
        {
            From = msg.ReadIPEndPoint();

            if (msg.ReadBoolean())
            {
                var entry = new LogEntry();
                var index = new LogIndex();

                index.Term = msg.ReadUInt32();
                index.Type = (LogIndexType)msg.ReadUInt32();
                index.ChunkOffset = msg.ReadUInt32();
                index.ChunkSize = msg.ReadUInt32();
                index.Flag1 = msg.ReadUInt32();
                index.Flag2 = msg.ReadUInt32();
                index.Flag3 = msg.ReadUInt32();
                index.Flag4 = msg.ReadUInt32();

                entry.Index = index;

                var dataLength = msg.ReadInt32();
                entry.Data = msg.ReadBytes(dataLength);

                Entry = entry;
            }
            else
            {
                Entry = null;
            }
        }
Example #3
0
        public void Read(BinaryReader msg)
        {
            From = msg.ReadIPEndPoint();
            AgentIP = msg.ReadIPEndPoint();
            Term = msg.ReadUInt32();
            PrevTerm = msg.ReadUInt32();
            PrevIndex = msg.ReadUInt32();
            CommitIndex = msg.ReadUInt32();

            var length = msg.ReadInt32();
            if (length > 0)
            {
                Entries = new LogEntry[length];
                for (var i = 0; i < length; i++)
                {
                    var entry = new LogEntry();
                    var index = new LogIndex();

                    index.Term = msg.ReadUInt32();
                    index.Type = (LogIndexType)msg.ReadUInt32();
                    index.ChunkOffset = msg.ReadUInt32();
                    index.ChunkSize = msg.ReadUInt32();
                    index.Flag1 = msg.ReadUInt32();
                    index.Flag2 = msg.ReadUInt32();
                    index.Flag3 = msg.ReadUInt32();
                    index.Flag4 = msg.ReadUInt32();

                    entry.Index = index;

                    var dataLength = msg.ReadInt32();
                    entry.Data = msg.ReadBytes(dataLength);

                    Entries[i] = entry;
                }
            }
        }
Example #4
0
 public void Read(BinaryReader msg)
 {
     From = msg.ReadIPEndPoint();
     Status = (AddServerStatus)msg.ReadUInt32();
     LeaderHint = msg.ReadIPEndPoint();
 }
Example #5
0
 public void Read(BinaryReader msg)
 {
     From = msg.ReadIPEndPoint();
 }
Example #6
0
 public void Read(BinaryReader msg)
 {
     From = msg.ReadIPEndPoint();
     Term = msg.ReadUInt32();
     Granted = msg.ReadBoolean();
 }
Example #7
0
 public void Read(BinaryReader msg)
 {
     From = msg.ReadIPEndPoint();
     Index = msg.ReadUInt32();
 }
Example #8
0
 public void Read(BinaryReader msg)
 {
     From = msg.ReadIPEndPoint();
     Term = msg.ReadUInt32();
     MatchIndex = msg.ReadUInt32();
     Success = msg.ReadBoolean();
 }