buffer

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package buffer links an input and an output together and buffers messages in between.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Descriptions

func Descriptions() string

Descriptions returns a formatted string of collated descriptions of each type.

Types

type Config

type Config struct {
	Type   string                `json:"type" yaml:"type"`
	Mmap   impl.MmapBufferConfig `json:"mmap_file" yaml:"mmap_file"`
	Memory impl.MemoryConfig     `json:"memory" yaml:"memory"`
}

Config is the all encompassing configuration struct for all input types.

func NewConfig

func NewConfig() Config

NewConfig returns a configuration struct fully populated with default values.

type Empty

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

Empty is an empty buffer, simply forwards messages on directly.

func (*Empty) CloseAsync

func (e *Empty) CloseAsync()

CloseAsync shuts down the StackBuffer output and stops processing messages.

func (*Empty) ErrorsChan

func (e *Empty) ErrorsChan() <-chan []error

ErrorsChan returns the errors channel.

func (*Empty) MessageChan

func (e *Empty) MessageChan() <-chan types.Message

MessageChan returns the channel used for consuming messages from this input.

func (*Empty) ResponseChan

func (e *Empty) ResponseChan() <-chan types.Response

ResponseChan returns the response channel.

func (*Empty) StartListening

func (e *Empty) StartListening(responses <-chan types.Response) error

StartListening sets the channel for reading responses.

func (*Empty) StartReceiving

func (e *Empty) StartReceiving(msgs <-chan types.Message) error

StartReceiving assigns a messages channel for the output to read.

func (*Empty) WaitForClose

func (e *Empty) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the StackBuffer output has closed down.

type OutputWrapper added in v0.2.1

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

OutputWrapper wraps a buffer with a Producer/Consumer interface.

func (*OutputWrapper) CloseAsync added in v0.2.1

func (m *OutputWrapper) CloseAsync()

CloseAsync shuts down the OutputWrapper and stops processing messages.

func (*OutputWrapper) ErrorsChan added in v0.2.1

func (m *OutputWrapper) ErrorsChan() <-chan []error

ErrorsChan returns the errors channel.

func (*OutputWrapper) MessageChan added in v0.2.1

func (m *OutputWrapper) MessageChan() <-chan types.Message

MessageChan returns the channel used for consuming messages from this input.

func (*OutputWrapper) ResponseChan added in v0.2.1

func (m *OutputWrapper) ResponseChan() <-chan types.Response

ResponseChan returns the response channel.

func (*OutputWrapper) StartListening added in v0.2.1

func (m *OutputWrapper) StartListening(responses <-chan types.Response) error

StartListening sets the channel for reading responses.

func (*OutputWrapper) StartReceiving added in v0.2.1

func (m *OutputWrapper) StartReceiving(msgs <-chan types.Message) error

StartReceiving assigns a messages channel for the output to read.

func (*OutputWrapper) WaitForClose added in v0.2.1

func (m *OutputWrapper) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the OutputWrapper output has closed down.

type Type

type Type interface {
	types.Producer
	types.Consumer
	types.Closable

	// ErrorsChan returns the channel used for returning any accumulated errors.
	// This needs reading in the same select block where messages are sent as
	// the errors can occur at any time.
	ErrorsChan() <-chan []error
}

Type is the standard interface of an agent type.

func New added in v0.0.2

func New(conf Config, log log.Modular, stats metrics.Type) (Type, error)

New creates an input type based on an input configuration.

func NewEmpty

func NewEmpty(config Config, log log.Modular, stats metrics.Type) (Type, error)

NewEmpty creates a new buffer interface but doesn't buffer messages.

func NewMemory

func NewMemory(config Config, log log.Modular, stats metrics.Type) (Type, error)

NewMemory - Create a buffer held in memory.

func NewMmapFile

func NewMmapFile(config Config, log log.Modular, stats metrics.Type) (Type, error)

NewMmapFile creates a buffer held in memory and persisted to file through memory map.

func NewOutputWrapper added in v0.2.1

func NewOutputWrapper(buffer impl.Buffer, stats metrics.Type) Type

NewOutputWrapper creates a new Producer/Consumer around a buffer.

Directories

Path Synopsis
Package impl contains implementations of various buffer types.
Package impl contains implementations of various buffer types.

Jump to

Keyboard shortcuts

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