A thread-safe variant of a classic circular buffer with a double-twist
qringbuf is a circular buffer variant, similar to (but not a derivative of) Bip Buffer and spsc-bip-buffer/bbqueue. It provides a concurrency-friendly, zero-copy abstraction of io.ReadAtLeast() over a pre-allocated ring-buffer, populated asynchronously by a standalone goroutine. Refer to the implementation-notes diagrams to get a quick overview of how this works in practice.
This library is primarily designed for processing a series of arbitrary streams, each comprised of variable-length records. Refer to the Examples and to the StartFill(…) / NextRegion(…) combo for a crash-course in usage patterns.