Example #1
0
func (t *ErrorInTopic) Unmarshal(r *wipro.Reader) {
	t.TopicName = r.ReadString()
	t.ErrorInPartitions = make([]ErrorInPartition, int(r.ReadInt32()))
	for i := range t.ErrorInPartitions {
		t.ErrorInPartitions[i].Unmarshal(r)
	}
}
Example #2
0
func (t *FetchMessageSetInTopic) Unmarshal(r *wipro.Reader) {
	t.TopicName = r.ReadString()
	t.FetchMessageSetInPartitions = make([]FetchMessageSetInPartition, int(r.ReadInt32()))
	for i := range t.FetchMessageSetInPartitions {
		t.FetchMessageSetInPartitions[i].Unmarshal(r)
	}
}
Example #3
0
func (t *OffsetCommitInTopicV2) Unmarshal(r *wipro.Reader) {
	t.TopicName = r.ReadString()
	t.OffsetCommitInPartitionV2s = make([]OffsetCommitInPartitionV2, int(r.ReadInt32()))
	for i := range t.OffsetCommitInPartitionV2s {
		t.OffsetCommitInPartitionV2s[i].Unmarshal(r)
	}
}
Example #4
0
func (t *OffsetFetchRequestV1) Unmarshal(r *wipro.Reader) {
	t.ConsumerGroup = r.ReadString()
	t.PartitionInTopics = make([]PartitionInTopic, int(r.ReadInt32()))
	for i := range t.PartitionInTopics {
		t.PartitionInTopics[i].Unmarshal(r)
	}
}
Example #5
0
func (t *OffsetMetadataInTopic) Unmarshal(r *wipro.Reader) {
	t.TopicName = r.ReadString()
	t.OffsetMetadataInPartitions = make([]OffsetMetadataInPartition, int(r.ReadInt32()))
	for i := range t.OffsetMetadataInPartitions {
		t.OffsetMetadataInPartitions[i].Unmarshal(r)
	}
}
Example #6
0
func (t *OffsetCommitRequestV0) Unmarshal(r *wipro.Reader) {
	t.ConsumerGroupID = r.ReadString()
	t.OffsetCommitInTopicV0s = make([]OffsetCommitInTopicV0, int(r.ReadInt32()))
	for i := range t.OffsetCommitInTopicV0s {
		t.OffsetCommitInTopicV0s[i].Unmarshal(r)
	}
}
Example #7
0
func (t *OffsetRequest) Unmarshal(r *wipro.Reader) {
	t.ReplicaID = r.ReadInt32()
	t.TimeInTopics = make([]TimeInTopic, int(r.ReadInt32()))
	for i := range t.TimeInTopics {
		t.TimeInTopics[i].Unmarshal(r)
	}
}
Example #8
0
func (t *SizedMessage) Unmarshal(r *wipro.Reader) {
	t.Size = r.ReadInt32()
	start := r.Offset
	t.CRCMessage.Unmarshal(r)
	if r.Err == nil && int(t.Size) != r.Offset-start {
		r.Err = ErrSizeMismatch
	}
}
Example #9
0
func (t *CRCMessage) Unmarshal(r *wipro.Reader) {
	t.CRC = r.ReadUint32()
	start := r.Offset
	t.Message.Unmarshal(r)
	if r.Err == nil && t.CRC != crc32.ChecksumIEEE(r.B[start:r.Offset]) {
		r.Err = ErrCRCMismatch
	}
}
Example #10
0
func (t *TopicMetadata) Unmarshal(r *wipro.Reader) {
	t.ErrorCode.Unmarshal(r)
	t.TopicName = r.ReadString()
	t.PartitionMetadatas = make([]PartitionMetadata, int(r.ReadInt32()))
	for i := range t.PartitionMetadatas {
		t.PartitionMetadatas[i].Unmarshal(r)
	}
}
Example #11
0
func (t *RequestOrResponse) Unmarshal(r *wipro.Reader) {
	t.Size = r.ReadInt32()
	start := r.Offset
	t.M.Unmarshal(r)
	if r.Err == nil && int(t.Size) != r.Offset-start {
		r.Err = ErrSizeMismatch
	}
}
Example #12
0
func (t *TopicMetadataResponse) Unmarshal(r *wipro.Reader) {
	t.Brokers = make([]Broker, int(r.ReadInt32()))
	for i := range t.Brokers {
		t.Brokers[i].Unmarshal(r)
	}
	t.TopicMetadatas = make([]TopicMetadata, int(r.ReadInt32()))
	for i := range t.TopicMetadatas {
		t.TopicMetadatas[i].Unmarshal(r)
	}
}
Example #13
0
func (t *OffsetCommitRequestV2) Unmarshal(r *wipro.Reader) {
	t.ConsumerGroup = r.ReadString()
	t.ConsumerGroupGenerationID = r.ReadInt32()
	t.ConsumerID = r.ReadString()
	t.RetentionTime = r.ReadInt64()
	t.OffsetCommitInTopicV2s = make([]OffsetCommitInTopicV2, int(r.ReadInt32()))
	for i := range t.OffsetCommitInTopicV2s {
		t.OffsetCommitInTopicV2s[i].Unmarshal(r)
	}
}
Example #14
0
func (t *JoinGroupRequest) Unmarshal(r *wipro.Reader) {
	t.GroupID = r.ReadString()
	t.SessionTimeout = r.ReadInt32()
	t.MemberID = r.ReadString()
	t.ProtocolType = r.ReadString()
	t.GroupProtocols.Unmarshal(r)
}
Example #15
0
func (t *Request) Unmarshal(r *wipro.Reader) {
	t.APIKey = r.ReadInt16()
	t.APIVersion = r.ReadInt16()
	t.CorrelationID = r.ReadInt32()
	t.ClientID = r.ReadString()
	t.RequestMessage.Unmarshal(r)
}
Example #16
0
func (t *MessageSet) Unmarshal(r *wipro.Reader) {
	size := int(r.ReadInt32())
	start := r.Offset
	for r.Offset-start < size {
		var m OffsetMessage
		m.Unmarshal(r)
		if r.Err != nil {
			r.Err = nil
			r.Offset = len(r.B)
			return
		}
		*t = append(*t, m)
	}
}
Example #17
0
func (t *GroupDescription) Unmarshal(r *wipro.Reader) {
	t.ErrorCode.Unmarshal(r)
	t.GroupID = r.ReadString()
	t.State = r.ReadString()
	t.ProtocolType = r.ReadString()
	t.Protocol = r.ReadString()
	t.Members.Unmarshal(r)
}
Example #18
0
func (t *FetchRequest) Unmarshal(r *wipro.Reader) {
	t.ReplicaID = r.ReadInt32()
	t.MaxWaitTime = r.ReadInt32()
	t.MinBytes = r.ReadInt32()
	t.FetchOffsetInTopics = make([]FetchOffsetInTopic, int(r.ReadInt32()))
	for i := range t.FetchOffsetInTopics {
		t.FetchOffsetInTopics[i].Unmarshal(r)
	}
}
Example #19
0
func (t *PartitionAssignment) Unmarshal(r *wipro.Reader) {
	t.Topic = r.ReadString()
	t.Partitions = make([]int32, int(r.ReadInt32()))
	for i := range t.Partitions {
		t.Partitions[i] = r.ReadInt32()
	}
}
Example #20
0
func (t *Member) Unmarshal(r *wipro.Reader) {
	t.MemberID = r.ReadString()
	t.ClientID = r.ReadString()
	t.ClientHost = r.ReadString()
	t.MemberMetadata = r.ReadBytes()
	t.MemberAssignment.Unmarshal(r)
}
Example #21
0
func (t *JoinGroupResponse) Unmarshal(r *wipro.Reader) {
	t.ErrorCode.Unmarshal(r)
	t.GenerationID = r.ReadInt32()
	t.GroupProtocolName = r.ReadString()
	t.LeaderID = r.ReadString()
	t.MemberID = r.ReadString()
	t.MemberWithMetas.Unmarshal(r)
}
Example #22
0
func (t *ProduceRequest) Unmarshal(r *wipro.Reader) {
	t.RequiredAcks = r.ReadInt16()
	t.Timeout = r.ReadInt32()
	t.MessageSetInTopics = make([]MessageSetInTopic, int(r.ReadInt32()))
	for i := range t.MessageSetInTopics {
		t.MessageSetInTopics[i].Unmarshal(r)
	}
}
Example #23
0
func (t *OffsetsInPartition) Unmarshal(r *wipro.Reader) {
	t.Partition = r.ReadInt32()
	t.ErrorCode.Unmarshal(r)
	t.Offsets = make([]int64, int(r.ReadInt32()))
	for i := range t.Offsets {
		t.Offsets[i] = r.ReadInt64()
	}
}
Example #24
0
func TestUnmarshal(t *testing.T) {
	t.Parallel()
	r := wipro.Reader{
		B: []byte{0x0, 0x0, 0x1, 0x7a, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x74, 0x65, 0x73, 0x74, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x0, 0x0, 0x1, 0x56, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2d, 0x9, 0xf8, 0xf8, 0x91, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x32, 0x30, 0x31, 0x35, 0x2d, 0x30, 0x39, 0x2d, 0x31, 0x35, 0x54, 0x32, 0x32, 0x3a, 0x31, 0x38, 0x3a, 0x30, 0x31, 0x2b, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x0, 0x0, 0x0, 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, 0x6c, 0x6c, 0x6f, 0x20, 0x32, 0x30, 0x31, 0x35, 0x2d, 0x30, 0x39, 0x2d, 0x31, 0x35, 0x54, 0x32, 0x32, 0x3a, 0x31, 0x38, 0x3a, 0x35, 0x31, 0x2b, 0x30, 0x38, 0x3a, 0x30, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x2d, 0x13, 0x20, 0xd9, 0x52, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x32, 0x30, 0x31, 0x35, 0x2d, 0x30, 0x39, 0x2d, 0x31, 0x35, 0x54, 0x32, 0x32, 0x3a, 0x31, 0x38, 0x3a, 0x35, 0x34, 0x2b, 0x30, 0x38, 0x3a, 0x30, 0x30},
	}
	messageCount := 6
	{
		resp := FetchResponse{}
		(&RequestOrResponse{M: &Response{ResponseMessage: &resp}}).Unmarshal(&r)
		if r.Err != nil {
			t.Fatal(r.Err)
		}
		if len(resp) != 1 ||
			len(resp[0].FetchMessageSetInPartitions) != 1 ||
			len(resp[0].FetchMessageSetInPartitions[0].MessageSet) != messageCount {
			t.Fatal("fail to parse truncated message set")
		}
	}
	{
		r.Reset()
		size := r.ReadInt32()
		size -= 2
		r.B = r.B[:size+4]
		(&wipro.Writer{B: r.B}).SetInt32(0, size)
		r.Reset()
		messageCount--

		resp := FetchResponse{}
		(&RequestOrResponse{M: &Response{ResponseMessage: &resp}}).Unmarshal(&r)
		if r.Err != nil {
			t.Fatal(r.Err)
		}
		if len(resp) != 1 ||
			len(resp[0].FetchMessageSetInPartitions) != 1 ||
			len(resp[0].FetchMessageSetInPartitions[0].MessageSet) != 5 {
			t.Fatal("fail to parse truncated message set")
		}
	}
}
Example #25
0
func (t *HeartbeatRequest) Unmarshal(r *wipro.Reader) {
	t.GroupID = r.ReadString()
	t.GenerationID = r.ReadInt32()
	t.MemberID = r.ReadString()
}
Example #26
0
func (t *MemberWithMeta) Unmarshal(r *wipro.Reader) {
	t.MemberID = r.ReadString()
	t.MemberMetadata = r.ReadBytes()
}
Example #27
0
func (t *PartitionAssignments) Unmarshal(r *wipro.Reader) {
	(*t) = make([]PartitionAssignment, int(r.ReadInt32()))
	for i := range *t {
		(*t)[i].Unmarshal(r)
	}
}
Example #28
0
func (t *MemberAssignment) Unmarshal(r *wipro.Reader) {
	t.Version = r.ReadInt16()
	t.PartitionAssignments.Unmarshal(r)
}
Example #29
0
func (t *GroupAssignment) Unmarshal(r *wipro.Reader) {
	t.MemberID = r.ReadString()
	t.MemberAssignment.Unmarshal(r)
}
Example #30
0
func (t *SyncGroupRequest) Unmarshal(r *wipro.Reader) {
	t.GroupID = r.ReadString()
	t.GenerationID = r.ReadInt32()
	t.MemberID = r.ReadString()
	t.GroupAssignments.Unmarshal(r)
}