input

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 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

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

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

func (*Amqp) Name

func (a *Amqp) Name() string

func (*Amqp) Start

func (a *Amqp) Start() error

func (*Amqp) Stop

func (a *Amqp) Stop() bool

type Closable

type Closable interface {
	Close() error
}

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

type Dispatcher

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

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

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

NewListener creates a new listener.

func (*Listener) Name

func (l *Listener) Name() string

func (*Listener) Start

func (l *Listener) Start() error

func (*Listener) Stop

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

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

func (p *Plain) Kind() string

type Plugin

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

type TimeoutConn

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

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

func NewTimeoutConn

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

func (TimeoutConn) Read

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