NewHeadTailBufferSized creates a HeadTailBuffer with custom head and tail sizes. This is useful for testing truncation logic with smaller buffers.
(maxHead, maxTail int)
| 66 | // head and tail sizes. This is useful for testing truncation |
| 67 | // logic with smaller buffers. |
| 68 | func NewHeadTailBufferSized(maxHead, maxTail int) *HeadTailBuffer { |
| 69 | b := &HeadTailBuffer{ |
| 70 | maxHead: maxHead, |
| 71 | maxTail: maxTail, |
| 72 | } |
| 73 | b.cond = sync.NewCond(&b.mu) |
| 74 | return b |
| 75 | } |
| 76 | |
| 77 | // Write implements io.Writer. It is safe for concurrent use. |
| 78 | // All bytes are accepted; the return value always equals |
no outgoing calls