xfer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProbePort is the default port that the probe(s) will listen on to
	// publish reports.
	ProbePort = 4030

	// AppPort is the default port that the app will use for its HTTP server.
	AppPort = 4040
)
View Source
var (
	// MaxBackoff is the maximum time between connect retries.
	MaxBackoff = 2 * time.Minute // externally configurable.
)

Functions

This section is empty.

Types

type Collector

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

Collector connects to probes over TCP and merges reports published by those probes into a single one.

func NewCollector

func NewCollector(batchTime time.Duration) *Collector

NewCollector starts the report collector.

func (*Collector) AddAddress

func (c *Collector) AddAddress(ip string)

AddAddress adds the passed IP to the collector, and starts (trying to) collect reports from the remote Publisher.

func (*Collector) AddAddresses

func (c *Collector) AddAddresses(ips []string)

AddAddresses adds the passed IPs to the collector, and starts (trying to) collect reports from the remote Publisher.

func (*Collector) RemoveAddress

func (c *Collector) RemoveAddress(ip string)

RemoveAddress removes the passed IP from the collector, and stops collecting reports from the remote Publisher.

func (*Collector) Reports

func (c *Collector) Reports() <-chan report.Report

Reports returns the channel where aggregate reports are sent.

func (*Collector) Stop

func (c *Collector) Stop()

Stop shuts down a collector and all connections to probes.

type Publisher

type Publisher interface {
	Publish(report.Report)
	Close()
}

Publisher provides a way to send reports upstream.

type TCPPublisher

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

TCPPublisher is a Publisher implementation which uses TCP and gob encoding.

func NewTCPPublisher

func NewTCPPublisher(listenAddress string) (*TCPPublisher, error)

NewTCPPublisher listens for connections on listenAddress. Only one client is accepted at a time; other clients are accepted, but disconnected right away. Reports published via publish() will be written to the connected client, if any. Gentle shutdown of the returned publisher via close().

func (*TCPPublisher) Close

func (p *TCPPublisher) Close()

Close stops a TCPPublisher and closes the socket.

func (*TCPPublisher) Publish

func (p *TCPPublisher) Publish(msg report.Report)

Publish sens a Report to the client, if any.

Jump to

Keyboard shortcuts

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