input

package
Version: v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: BSD-2-Clause-Views Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AMQPConnector added in v0.11.0

func AMQPConnector(a *Amqp) error

AMQPConnector connects using the given configuration

Types

type Amqp

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

Amqp is a plugin that consumes from an amqp broker

func NewAMQP added in v0.11.0

func NewAMQP(config cfg.Config, dispatcher Dispatcher, connect amqpConnector) *Amqp

func (*Amqp) Name added in v0.11.0

func (a *Amqp) Name() string

func (*Amqp) Start added in v0.11.0

func (a *Amqp) Start() error

func (*Amqp) Stop added in v0.11.0

func (a *Amqp) Stop() bool

type Closable added in v0.11.0

type Closable interface {
	Close() error
}

Closable can be closed. E.g. channel, net.Conn

type Dispatcher added in v0.11.0

type Dispatcher interface {
	// Dispatch runs data validation and processing
	// implementations must not reuse buf after returning
	Dispatch(buf []byte)
	// IncNumInvalid marks protocol-level decoding failures
	// does not apply to carbon as the protocol is trivial and any parse failure
	// is a message failure (handled in Dispatch)
	IncNumInvalid()
}

type Handler

type Handler interface {
	Kind() string
	Handle(io.Reader) error
}

Handler is responsible for reading input. It should call: Dispatcher.IncNumInvalid upon protocol errors Dispatcher.Dispatch to process data that's protocol-valid

type Listener added in v0.11.0

type Listener struct {
	Handler Handler

	HandleConn func(l *Listener, c net.Conn)
	HandleData func(l *Listener, data []byte, src net.Addr)
	// contains filtered or unexported fields
}

Listener takes care of TCP/UDP networking and relies on the Handler to take care of reading data

func NewListener added in v0.11.0

func NewListener(addr string, readTimeout time.Duration, handler Handler) *Listener

NewListener creates a new listener.

func (*Listener) Name added in v0.11.0

func (l *Listener) Name() string

func (*Listener) Start added in v0.11.0

func (l *Listener) Start() error

func (*Listener) Stop added in v0.11.0

func (l *Listener) Stop() bool

type Pickle

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

func NewPickle

func NewPickle(dispatcher Dispatcher) *Pickle

func (*Pickle) Handle

func (p *Pickle) Handle(c io.Reader) error

func (*Pickle) Kind added in v0.11.0

func (p *Pickle) Kind() string

type Plain

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

func NewPlain

func NewPlain(dispatcher Dispatcher) *Plain

func (*Plain) Handle

func (p *Plain) Handle(c io.Reader) error

func (*Plain) Kind added in v0.11.0

func (p *Plain) Kind() string

type Plugin added in v0.11.0

type Plugin interface {
	Name() string
	Start() error
	Stop() bool
}

type TimeoutConn added in v0.11.0

type TimeoutConn struct {
	net.Conn
	// contains filtered or unexported fields
}

TimeoutConn automatically applies a read deadline on a conn upon every read

func NewTimeoutConn added in v0.11.0

func NewTimeoutConn(conn net.Conn, readTimeout time.Duration) TimeoutConn

func (TimeoutConn) Read added in v0.11.0

func (t TimeoutConn) Read(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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