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

Function NewControlBatch

protocol/record_batch.go:249–257  ·  view source on GitHub ↗

NewControlBatch constructs a control batch from the list of records passed as arguments.

(records ...ControlRecord)

Source from the content-addressed store, hash-verified

247// NewControlBatch constructs a control batch from the list of records passed as
248// arguments.
249func NewControlBatch(records ...ControlRecord) *ControlBatch {
250 rawRecords := make([]Record, len(records))
251 for i, cr := range records {
252 rawRecords[i] = cr.Record()
253 }
254 return &ControlBatch{
255 Records: NewRecordReader(rawRecords...),
256 }
257}
258
259func (c *ControlBatch) ReadRecord() (*Record, error) {
260 return c.Records.ReadRecord()

Callers 1

TestControlRecordFunction · 0.85

Calls 2

NewRecordReaderFunction · 0.70
RecordMethod · 0.45

Tested by 1

TestControlRecordFunction · 0.68