sources

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadAllTargets

func ReadAllTargets(ctx context.Context, snk sinks.Sinker, src Sourcer) error

ReadAllTargets drains a source of log data

Types

type Action

type Action int

Action indicates the type of update

const (
	// Add indicates a new source has been added
	Add Action = iota

	// Remove indicates a watched source has been added
	Remove
)

func (Action) String

func (i Action) String() string

type MessageReader

type MessageReader interface {
	MessageRead(ctx context.Context) (*logspray.Message, error)
}

MessageReader is used to Read a message from a source.

type Sourcer

type Sourcer interface {
	// Updater implementation required to find new streams.
	Updater

	// ReadTarget is called in response to a new target being found by the updater
	// The supplied context will be cancel'ed when the updater sees the source go
	// away. FromStart indicates whther you should read the stream from the
	// beginning, or the current position.
	ReadTarget(ctx context.Context, id string, FromStart bool) (MessageReader, error)
}

Sourcer watches some arbitrary potential source of multiple log streams. Each time the Updater spots a new stream, ReadTarget is called to read message from that stream.

type Update

type Update struct {
	Action Action
	Target string
	Labels map[string]string
}

Update describe an update to a watched filesystem

type Updater

type Updater interface {
	Next(context.Context) ([]*Update, error)
}

Updaer is used to watch for changes to a set of potential log sources. The furst call to Next should return any pre-existing log sources. Subsequent calls should describe changes to that set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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