ring

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer represents a circular array of data items.

func NewBuffer

func NewBuffer(length int) *Buffer

NewBuffer returns an initialized ring buffer.

func (*Buffer) Close

func (r *Buffer) Close()

func (*Buffer) Closed

func (r *Buffer) Closed() bool

func (*Buffer) GetAll

func (r *Buffer) GetAll() ([][]byte, bool)

func (*Buffer) Has

func (r *Buffer) Has(item []byte) bool

func (*Buffer) Put

func (r *Buffer) Put(item []byte)

Put an item on the ring buffer.

type Consumer

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

Consumer represents an entity which can read items from a ring buffer. It maintains its own read index, and cache.

func NewConsumer

func NewConsumer(ring *Buffer, callback func(items [][]byte, w io.WriteCloser) bool, w io.WriteCloser) *Consumer

NewConsumer returns a Consumer, which can read from the passed Buffer.

Jump to

Keyboard shortcuts

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