rx_batch.go 438 B

123456789101112
  1. package batch
  2. type RxBatcher interface {
  3. // Reserve creates a pkt to borrow
  4. Reserve(sz int) []byte
  5. // Commit borrows pkt. The caller must keep pkt valid until the next Flush
  6. Commit(pkt []byte) error
  7. // Flush emits every queued packet in arrival order. Returns the
  8. // first error observed; keeps draining so one bad packet doesn't hold up
  9. // the rest. After Flush returns, borrowed payload slices may be recycled.
  10. Flush() error
  11. }