MCPcopy
hub / github.com/segmentio/kafka-go / writeFetchRequestV2

Method writeFetchRequestV2

write.go:168–202  ·  write.go::writeBuffer.writeFetchRequestV2
(correlationID int32, clientID, topic string, partition int32, offset int64, minBytes, maxBytes int, maxWait time.Duration)

Source from the content-addressed store, hash-verified

166}
167
168func (wb *writeBuffer) writeFetchRequestV2(correlationID int32, clientID, topic string, partition int32, offset int64, minBytes, maxBytes int, maxWait time.Duration) error {
169 h := requestHeader{
170 ApiKey: int16(fetch),
171 ApiVersion: int16(v2),
172 CorrelationID: correlationID,
173 ClientID: clientID,
174 }
175 h.Size = (h.size() - 4) +
176 4 + // replica ID
177 4 + // max wait time
178 4 + // min bytes
179 4 + // topic array length
180 sizeofString(topic) +
181 4 + // partition array length
182 4 + // partition
183 8 + // offset
184 4 // max bytes
185
186 h.writeTo(wb)
187 wb.writeInt32(-1) // replica ID
188 wb.writeInt32(milliseconds(maxWait))
189 wb.writeInt32(int32(minBytes))
190
191 // topic array
192 wb.writeArrayLen(1)
193 wb.writeString(topic)
194
195 // partition array
196 wb.writeArrayLen(1)
197 wb.writeInt32(partition)
198 wb.writeInt64(offset)
199 wb.writeInt32(int32(maxBytes))
200
201 return wb.Flush()
202}
203
204func (wb *writeBuffer) writeFetchRequestV5(correlationID int32, clientID, topic string, partition int32, offset int64, minBytes, maxBytes int, maxWait time.Duration, isolationLevel int8) error {
205 h := requestHeader{

Callers 2

ReadBatchWithMethod · 0.80
testWriteFetchRequestV2Function · 0.80

Calls 9

sizeMethod · 0.95
writeToMethod · 0.95
writeInt32Method · 0.95
writeArrayLenMethod · 0.95
writeStringMethod · 0.95
writeInt64Method · 0.95
FlushMethod · 0.95
sizeofStringFunction · 0.85
millisecondsFunction · 0.85

Tested by 1

testWriteFetchRequestV2Function · 0.64