dropsonde_consumer

package
v6.9.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2015 License: Apache-2.0, BSD-3-Clause, MIT, + 1 more Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KeepAlive sets the interval between keep-alive messages sent by the client to loggregator.
	KeepAlive = 25 * time.Second

	ErrNotFound    = errors.New("/recent path not found or has issues")
	ErrBadResponse = errors.New("bad server response")
	ErrBadRequest  = errors.New("bad client request")
)

Functions

func SortRecent

func SortRecent(messages []*events.Envelope) []*events.Envelope

SortRecent sorts a slice of LogMessages by timestamp. The sort is stable, so messages with the same timestamp are sorted in the order that they are received.

The input slice is sorted; the return value is simply a pointer to the same slice.

Types

type DebugPrinter

type DebugPrinter interface {
	Print(title, dump string)
}

type DropsondeConsumer

type DropsondeConsumer interface {

	//	TailingLogs listens indefinitely for log messages. It returns two channels; the first is populated
	//	with log messages, while the second contains errors (e.g. from parsing messages). It returns
	//	immediately. Call Close() to terminate the connection when you are finished listening.
	//
	//	Messages are presented in the order received from the loggregator server. Chronological or
	//	other ordering is not guaranteed. It is the responsibility of the consumer of these channels
	//	to provide any desired sorting mechanism.
	TailingLogs(appGuid string, authToken string) (<-chan *events.Envelope, error)

	/*
		Stream listens indefinitely for log and event messages. It returns two channels; the first is populated
		with log and event messages, while the second contains errors (e.g. from parsing messages). It returns immediately.
		Call Close() to terminate the connection when you are finished listening.

		Messages are presented in the order received from the loggregator server. Chronological or other ordering
		is not guaranteed. It is the responsibility of the consumer of these channels to provide any desired sorting
		mechanism.
	*/
	Stream(appGuid string, authToken string) (<-chan *events.Envelope, error)

	//	Recent connects to loggregator via its 'recent' endpoint and returns a slice of recent messages.
	//	It does not guarantee any order of the messages; they are in the order returned by loggregator.
	//
	//	The SortRecent method is provided to sort the data returned by this method.
	RecentLogs(appGuid string, authToken string) ([]*events.Envelope, error)

	// Close terminates the websocket connection to loggregator.
	Close() error

	// SetOnConnectCallback sets a callback function to be called with the websocket connection is established.
	SetOnConnectCallback(func())

	// SetDebugPrinter enables logging of the websocket handshake
	SetDebugPrinter(DebugPrinter)
}

DropsondeConsumer represents the actions that can be performed against a loggregator server.

func NewDropsondeConsumer

func NewDropsondeConsumer(endpoint string, tlsConfig *tls.Config, proxy func(*http.Request) (*url.URL, error)) DropsondeConsumer

New creates a new consumer to a loggregator endpoint.

Jump to

Keyboard shortcuts

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