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

Function recordBatchSize

recordbatch.go:23–34  ·  view source on GitHub ↗

msg count

(msgs ...Message)

Source from the content-addressed store, hash-verified

21 4 // msg count
22
23func recordBatchSize(msgs ...Message) (size int32) {
24 size = recordBatchHeaderSize
25 baseTime := msgs[0].Time
26
27 for i := range msgs {
28 msg := &msgs[i]
29 msz := recordSize(msg, msg.Time.Sub(baseTime), int64(i))
30 size += int32(msz + varIntLen(int64(msz)))
31 }
32
33 return
34}
35
36func compressRecordBatch(codec CompressionCodec, msgs ...Message) (compressed *bytes.Buffer, attributes int16, size int32, err error) {
37 compressed = acquireBuffer()

Callers 1

newRecordBatchFunction · 0.85

Calls 2

recordSizeFunction · 0.85
varIntLenFunction · 0.85

Tested by

no test coverage detected