Documentation
¶
Overview ¶
Package ringbuf implements the SDK's bounded pending buffer. It is a circular FIFO bounded by both an item count and a byte budget. On overflow it evicts the oldest entries ("drop-oldest, newest wins") and reports how many were dropped, so the pipeline can account for them. All operations are safe for concurrent use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer[T any] struct { // contains filtered or unexported fields }
Buffer is a bounded circular FIFO. Construct one with New; the zero value is not usable.
func New ¶
New returns a buffer bounded by maxItems entries and maxBytes total estimated size. Non-positive bounds fall back to permissive defaults. sizeOf may be nil, in which case every item is counted as one byte.
func (*Buffer[T]) DrainAll ¶
func (b *Buffer[T]) DrainAll() []T
DrainAll removes and returns every entry, oldest first.