Skip to content

ipfs/go-qringbuf

Repository files navigation

q(uantized)ringbuf(fer)

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.

Documentation

https://pkg.go.dev/github.com/ipfs/go-qringbuf

Lead Maintainer

Peter Rabbitson

License

SPDX-License-Identifier: Apache-2.0 OR MIT

About

An implementation of a Quantized Ring Buffer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages