ring

package module
v0.0.0-...-c70196a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2017 License: MIT Imports: 1 Imported by: 0

README

ring

An wrapper for container/ring that makes it easy to read and write different indexes of the same ring.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ring

type Ring struct {
	// contains filtered or unexported fields
}

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.

func NewRing

func NewRing(size int) *Ring

Return a new Ring with the specified capactiy.

func (*Ring) Read

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 (*Ring) Write

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL