forwarder

package
v0.0.0-...-7a6af9b Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBufferSize        = 100
	DefaultKeepAliveInterval = 30
)

Some sane values to default things to

Variables

This section is empty.

Functions

func RegisterForwarder

func RegisterForwarder(name string, f func(int, *l.Entry) Forwarder)

RegisterForwarder takes forwarder name and constructor function and returns a forwarder

Types

type BaseForwarder

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

BaseForwarder is class to handle the boiler plate parts of the forwarders

func (*BaseForwarder) InitListeners

func (base *BaseForwarder) InitListeners(globalConfig config.Config)

InitListeners - initiate channels for listeners

func (BaseForwarder) InternalMetrics

func (base BaseForwarder) InternalMetrics() InternalMetrics

InternalMetrics : Returns the internal metrics that are being collected by this forwarder

func (BaseForwarder) KeepAliveInterval

func (base BaseForwarder) KeepAliveInterval() int

KeepAliveInterval - return keep alive interval

func (BaseForwarder) ListenerChannels

func (base BaseForwarder) ListenerChannels() map[string]chan []byte

ListenerChannels : the channels to forwarders listens for messages on

func (BaseForwarder) MaxBufferSize

func (base BaseForwarder) MaxBufferSize() int

MaxBufferSize : the maximum number of messages to be in the circular buffer

func (BaseForwarder) Name

func (base BaseForwarder) Name() string

Name : the name of the forwarder

func (*BaseForwarder) SetKeepAliveInterval

func (base *BaseForwarder) SetKeepAliveInterval(value int)

SetKeepAliveInterval : Set keep alive interval

func (*BaseForwarder) SetListenerChannels

func (base *BaseForwarder) SetListenerChannels(c map[string]chan []byte)

SetListenerChannels : the channels to forwarder listens for messages on

func (*BaseForwarder) SetMaxBufferSize

func (base *BaseForwarder) SetMaxBufferSize(size int)

SetMaxBufferSize : set the buffer size

func (BaseForwarder) String

func (base BaseForwarder) String() string

String returns the forwarder name in a printable format.

type Forwarder

type Forwarder interface {
	Run()
	Configure(map[string]interface{})
	InitListeners(config.Config)

	// InternalMetrics is to publish a set of values
	// that are relevant to the forwarder itself.
	InternalMetrics() InternalMetrics

	// taken care of by the base
	Name() string
	String() string

	ListenerChannels() map[string]chan []byte
	SetListenerChannels(map[string]chan []byte)

	MaxBufferSize() int
	SetMaxBufferSize(int)

	KeepAliveInterval() int
	SetKeepAliveInterval(int)
}

Forwarder defines the interface of a generic forwarder.

func New

func New(name string) Forwarder

New creates a new Forwarder based on the requested forwarder name.

type InternalMetrics

type InternalMetrics struct {
	Counters map[string]float64
	Gauges   map[string]float64
}

InternalMetrics holds the key:value pairs for counters/gauges

func NewInternalMetrics

func NewInternalMetrics() *InternalMetrics

NewInternalMetrics initializes the internal components of InternalMetrics

type Kafka

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

Kafka forwarder

func (*Kafka) Configure

func (k *Kafka) Configure(configMap map[string]interface{})

Configure the Kafka forwarder

func (*Kafka) Run

func (k *Kafka) Run()

Run runs the forwarder main loop

type TCP

type TCP struct {
	BaseForwarder
	// contains filtered or unexported fields
}

TCP forwarder

func (*TCP) Configure

func (t *TCP) Configure(configMap map[string]interface{})

Configure the TCP forwarder

func (*TCP) Run

func (t *TCP) Run()

Run runs the forwarder main loop

type UDP

type UDP struct {
	BaseForwarder
	// contains filtered or unexported fields
}

UDP forwarder

func (*UDP) Configure

func (u *UDP) Configure(configMap map[string]interface{})

Configure the UDP forwader

func (*UDP) Run

func (u *UDP) Run()

Run runs the forwarder main loop

Jump to

Keyboard shortcuts

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