Discover Packages
github.com/inhies/ring
package
module
Version:
v0.0.0-...-c70196a
Opens a new window with list of versions in this module.
Published: Jul 17, 2017
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
ring
An wrapper for container/ring that makes it easy to read and write different indexes of the same ring.
Expand ▾
Collapse ▴
Documentation
¶
Ring represents a container/ring with seperate reader and writer interfaces.
It will only read non-nil values and will overwrite the oldest values on
subsequent Write()'s. Originally designed as a FIFO packet buffer.
Return a new Ring with the specified capactiy.
func (r *Ring ) Read() interface{}
Read the next value from the ring. If the value is nil, we will sit here
until there is a non-nil value to return, then advance for the next Read().
func (r *Ring ) Write(value interface{})
Write the value to the Ring. Write's will always succeed and will overwrite
the oldest elements in the Ring first.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.