output

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package output - Defines dispatchers of data for a variety of targets. All output types must implement interface output.Type.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFanOutNoOutputs - Returned when creating a FanOut type with zero outputs.
	ErrFanOutNoOutputs = errors.New("attempting to create fan_out output type with no outputs")
)
View Source
var (
	// ErrRoundRobinNoOutputs - Returned when creating a RoundRobin type with zero outputs.
	ErrRoundRobinNoOutputs = errors.New("attempting to create round_robin output with no outputs")
)

Functions

func Descriptions

func Descriptions() string

Descriptions - Returns a formatted string of collated descriptions of each type.

Types

type AMQP added in v0.0.2

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

AMQP - An output type that serves AMQP messages.

func (*AMQP) CloseAsync added in v0.0.2

func (a *AMQP) CloseAsync()

CloseAsync - Shuts down the AMQP output and stops processing messages.

func (*AMQP) ResponseChan added in v0.0.2

func (a *AMQP) ResponseChan() <-chan types.Response

ResponseChan - Returns the errors channel.

func (*AMQP) StartReceiving added in v0.0.2

func (a *AMQP) StartReceiving(msgs <-chan types.Message) error

StartReceiving - Assigns a messages channel for the output to read.

func (*AMQP) WaitForClose added in v0.0.2

func (a *AMQP) WaitForClose(timeout time.Duration) error

WaitForClose - Blocks until the AMQP output has closed down.

type AMQPConfig added in v0.0.2

type AMQPConfig struct {
	URI          string `json:"uri" yaml:"uri"`
	Exchange     string `json:"exchange" yaml:"exchange"`
	ExchangeType string `json:"exchange_type" yaml:"exchange_type"`
	BindingKey   string `json:"key" yaml:"key"`
}

AMQPConfig - Configuration for the AMQP output type.

func NewAMQPConfig added in v0.0.2

func NewAMQPConfig() AMQPConfig

NewAMQPConfig - Creates a new AMQPConfig with default values.

type Config

type Config struct {
	Type       string           `json:"type" yaml:"type"`
	HTTPClient HTTPClientConfig `json:"http_client" yaml:"http_client"`
	HTTPServer HTTPServerConfig `json:"http_server" yaml:"http_server"`
	ScaleProto ScaleProtoConfig `json:"scalability_protocols" yaml:"scalability_protocols"`
	Kafka      KafkaConfig      `json:"kafka" yaml:"kafka"`
	AMQP       AMQPConfig       `json:"amqp" yaml:"amqp"`
	ZMQ4       *ZMQ4Config      `json:"zmq4,omitempty" yaml:"zmq4,omitempty"`
	File       FileConfig       `json:"file" yaml:"file"`
	STDOUT     struct{}         `json:"stdout" yaml:"stdout"`
	FanOut     FanOutConfig     `json:"fan_out" yaml:"fan_out"`
	RoundRobin RoundRobinConfig `json:"round_robin" yaml:"round_robin"`
}

Config - The all encompassing configuration struct for all output types. Note that some configs are empty structs, as the type has no optional values but we want to list it as an option.

func NewConfig

func NewConfig() Config

NewConfig - Returns a configuration struct fully populated with default values.

type FanOutConfig

type FanOutConfig struct {
	Outputs []interface{} `json:"outputs" yaml:"outputs"`
}

FanOutConfig - Configuration for the FanOut output type.

func NewFanOutConfig

func NewFanOutConfig() FanOutConfig

NewFanOutConfig - Creates a new FanOutConfig with default values.

type File

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

File - An output type that pushes messages to a single file.

func (*File) CloseAsync

func (f *File) CloseAsync()

CloseAsync - Shuts down the File output and stops processing messages.

func (*File) ResponseChan

func (f *File) ResponseChan() <-chan types.Response

ResponseChan - Returns the errors channel.

func (*File) StartReceiving

func (f *File) StartReceiving(msgs <-chan types.Message) error

StartReceiving - Assigns a messages channel for the output to read.

func (*File) WaitForClose

func (f *File) WaitForClose(timeout time.Duration) error

WaitForClose - Blocks until the File output has closed down.

type FileConfig

type FileConfig struct {
	Path string `json:"path" yaml:"path"`
}

FileConfig - Configuration values for the file based output type.

func NewFileConfig

func NewFileConfig() FileConfig

NewFileConfig - Create a new FileConfig with default values.

type HTTPClient

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

HTTPClient - An output type that pushes messages to HTTPClient.

func (*HTTPClient) CloseAsync

func (h *HTTPClient) CloseAsync()

CloseAsync - Shuts down the HTTPClient output and stops processing messages.

func (*HTTPClient) ResponseChan

func (h *HTTPClient) ResponseChan() <-chan types.Response

ResponseChan - Returns the errors channel.

func (*HTTPClient) StartReceiving

func (h *HTTPClient) StartReceiving(msgs <-chan types.Message) error

StartReceiving - Assigns a messages channel for the output to read.

func (*HTTPClient) WaitForClose

func (h *HTTPClient) WaitForClose(timeout time.Duration) error

WaitForClose - Blocks until the HTTPClient output has closed down.

type HTTPClientConfig

type HTTPClientConfig struct {
	URL       string `json:"url" yaml:"url"`
	TimeoutMS int64  `json:"timeout_ms" yaml:"timeout_ms"`
	RetryMS   int64  `json:"retry_period_ms" yaml:"retry_period_ms"`
}

HTTPClientConfig - Configuration for the HTTPClient output type.

func NewHTTPClientConfig

func NewHTTPClientConfig() HTTPClientConfig

NewHTTPClientConfig - Creates a new HTTPClientConfig with default values.

type HTTPServer

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

HTTPServer - An input type that serves HTTPServer POST requests.

func (*HTTPServer) CloseAsync

func (h *HTTPServer) CloseAsync()

CloseAsync - Shuts down the HTTPServer input and stops processing requests.

func (*HTTPServer) ResponseChan

func (h *HTTPServer) ResponseChan() <-chan types.Response

ResponseChan - Returns the errors channel.

func (*HTTPServer) StartReceiving

func (h *HTTPServer) StartReceiving(msgs <-chan types.Message) error

StartReceiving - Assigns a messages channel for the output to read.

func (*HTTPServer) WaitForClose

func (h *HTTPServer) WaitForClose(timeout time.Duration) error

WaitForClose - Blocks until the HTTPServer output has closed down.

type HTTPServerConfig

type HTTPServerConfig struct {
	Address         string `json:"address" yaml:"address"`
	Path            string `json:"path" yaml:"path"`
	ServerTimeoutMS int64  `json:"server_timeout_ms" yaml:"server_timeout_ms"`
	ClientTimeoutMS int64  `json:"client_timeout_ms" yaml:"client_timeout_ms"`
}

HTTPServerConfig - Configuration for the HTTPServer input type.

func NewHTTPServerConfig

func NewHTTPServerConfig() HTTPServerConfig

NewHTTPServerConfig - Creates a new HTTPServerConfig with default values.

type Kafka

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

Kafka - An output type that writes messages into kafka.

func (*Kafka) CloseAsync

func (k *Kafka) CloseAsync()

CloseAsync - Shuts down the Kafka output and stops processing messages.

func (*Kafka) ResponseChan

func (k *Kafka) ResponseChan() <-chan types.Response

ResponseChan - Returns the errors channel.

func (*Kafka) StartReceiving

func (k *Kafka) StartReceiving(msgs <-chan types.Message) error

StartReceiving - Assigns a messages channel for the output to read.

func (*Kafka) WaitForClose

func (k *Kafka) WaitForClose(timeout time.Duration) error

WaitForClose - Blocks until the Kafka output has closed down.

type KafkaConfig

type KafkaConfig struct {
	Addresses []string `json:"addresses" yaml:"addresses"`
	ClientID  string   `json:"client_id" yaml:"client_id"`
	Topic     string   `json:"topic" yaml:"topic"`
}

KafkaConfig - Configuration for the Kafka output type.

func NewKafkaConfig

func NewKafkaConfig() KafkaConfig

NewKafkaConfig - Creates a new KafkaConfig with default values.

type MockType

type MockType struct {
	ResChan chan types.Response
	MsgChan <-chan types.Message
}

MockType - Implements the output.Type interface.

func (MockType) CloseAsync

func (m MockType) CloseAsync()

CloseAsync - Does nothing.

func (*MockType) ResponseChan

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

ResponseChan - Returns the errors channel.

func (*MockType) StartReceiving

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

StartReceiving - Sets the read channel. This implementation is NOT thread safe.

func (MockType) WaitForClose

func (m MockType) WaitForClose(time.Duration) error

WaitForClose - Does nothing.

type RoundRobinConfig

type RoundRobinConfig struct {
	Outputs []interface{} `json:"outputs" yaml:"outputs"`
}

RoundRobinConfig - Configuration for the RoundRobin output type.

func NewRoundRobinConfig

func NewRoundRobinConfig() RoundRobinConfig

NewRoundRobinConfig - Creates a new RoundRobinConfig with default values.

type STDOUT

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

STDOUT - An output type that pushes messages to STDOUT.

func (*STDOUT) CloseAsync

func (s *STDOUT) CloseAsync()

CloseAsync - Shuts down the STDOUT output and stops processing messages.

func (*STDOUT) ResponseChan

func (s *STDOUT) ResponseChan() <-chan types.Response

ResponseChan - Returns the errors channel.

func (*STDOUT) StartReceiving

func (s *STDOUT) StartReceiving(msgs <-chan types.Message) error

StartReceiving - Assigns a messages channel for the output to read.

func (*STDOUT) WaitForClose

func (s *STDOUT) WaitForClose(timeout time.Duration) error

WaitForClose - Blocks until the STDOUT output has closed down.

type ScaleProto

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

ScaleProto - An output type that serves ScaleProto messages.

func (*ScaleProto) CloseAsync

func (s *ScaleProto) CloseAsync()

CloseAsync - Shuts down the ScaleProto output and stops processing messages.

func (*ScaleProto) ResponseChan

func (s *ScaleProto) ResponseChan() <-chan types.Response

ResponseChan - Returns the errors channel.

func (*ScaleProto) StartReceiving

func (s *ScaleProto) StartReceiving(msgs <-chan types.Message) error

StartReceiving - Assigns a messages channel for the output to read.

func (*ScaleProto) WaitForClose

func (s *ScaleProto) WaitForClose(timeout time.Duration) error

WaitForClose - Blocks until the ScaleProto output has closed down.

type ScaleProtoConfig

type ScaleProtoConfig struct {
	Address       string `json:"address" yaml:"address"`
	Bind          bool   `json:"bind_address" yaml:"bind_address"`
	SocketType    string `json:"socket_type" yaml:"socket_type"`
	PollTimeoutMS int    `json:"poll_timeout_ms" yaml:"poll_timeout_ms"`
}

ScaleProtoConfig - Configuration for the ScaleProto output type.

func NewScaleProtoConfig

func NewScaleProtoConfig() ScaleProtoConfig

NewScaleProtoConfig - Creates a new ScaleProtoConfig with default values.

type Type

type Type interface {
	types.Closable
	types.Consumer
}

Type - The standard interface of an output type.

func New added in v0.0.2

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

New - Create an input type based on an input configuration.

func NewAMQP added in v0.0.2

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

NewAMQP - Create a new AMQP output type.

func NewFanOut

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

NewFanOut - Create a new FanOut output type. Messages will be sent out to ALL outputs, outputs which block will apply backpressure upstream, meaning other outputs will also stop receiving messages.

func NewFile

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

NewFile - Create a new File output type.

func NewHTTPClient

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

NewHTTPClient - Create a new HTTPClient output type.

func NewHTTPServer

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

NewHTTPServer - Create a new HTTPServer input type.

func NewKafka

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

NewKafka - Create a new Kafka output type.

func NewRoundRobin

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

NewRoundRobin - Create a new RoundRobin output type. Messages will be sent out to an output chosen by following their original order. If an output blocks this will block all throughput.

func NewSTDOUT

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

NewSTDOUT - Create a new STDOUT output type.

func NewScaleProto

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

NewScaleProto - Create a new ScaleProto output type.

type ZMQ4Config

type ZMQ4Config struct{}

ZMQ4Config - Empty stub for when ZMQ4 is not compiled.

func NewZMQ4Config

func NewZMQ4Config() *ZMQ4Config

NewZMQ4Config - Returns nil.

Jump to

Keyboard shortcuts

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