Skip to content

Ring (circular) buffer implementation in Go which is concurrency safe

License

Notifications You must be signed in to change notification settings

zenhorace/ringo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ringo

Ring buffer implementation in Go which is concurrency safe.

A ring buffer (or circular queue) is a fixed capacity buffer. When the capacity is reached, the buffer loops back over itself, overwriting the oldest values. In this sense it is a FIFO data structure. All operations are O(1). This implementation is append/push only. Values are only removed by getting over-written.

Why a ring buffer?

Popular use cases and benefits:

  • Buffered data streams. For scenarios where you ingest large amounts of data but are only concerned with the most recent/up-to-date values
  • Memory constrained systems. Offers a fixed sized data structure so no worries of it growing as the data grows.
  • No need to perform expensive copy/swaps/reorganizing of data

Supported Operations:

  • Push to the buffer
  • Get the oldest entry
  • Get the newest entry
  • Snapshot of all current items from least to most recent.

About

Ring (circular) buffer implementation in Go which is concurrency safe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published