comm

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2014 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	EventType() EventType
	Data() map[string]interface{}
}

Event is the type that will be sent over the event channel

type EventChan

type EventChan chan Event

EventChan is a channel for status updates

type EventOptions

type EventOptions struct {
	EventType EventType
	Data      map[string]interface{}
}

EventOptions are the options when telling a Reporter to trigger an event

type EventType

type EventType uint8

EventType is a type for constants that indicate the type of event reported

const (
	// RequestedEvent is for when a build is initially requested
	RequestedEvent EventType = iota

	// BuildEvent is for when a `docker build` command starts
	BuildEvent

	// BuildCompletedEvent is for when a `docker build` command completes
	BuildCompletedEvent

	// TagEvent is for when a `docker tag` command starts
	TagEvent

	// TagCompletedEvent is for when a `docker tag` command finishes
	TagCompletedEvent

	// PushEvent is for when a `docker push` command starts
	PushEvent

	// PushCompletedEvent is for when a `docker push` command finishes
	PushCompletedEvent

	// CompletedEvent is for whe nthe entire build finishes (corresopnds to a RequestedEvent)
	CompletedEvent
)

func (EventType) String

func (t EventType) String() string

type ExitChan

type ExitChan chan error

ExitChan is a channel for receiving the final exit value (error or nil)

type LogChan

type LogChan chan LogEntry

LogChan is a channel for log entries

type LogEntry

type LogEntry interface {
	Entry() *logrus.Entry
	LogWithLogger(*logrus.Logger)
}

LogEntry is a convenient, extensible way to ship logrus log entries

func NewLogEntry

func NewLogEntry(l *logrus.Entry) LogEntry

NewLogEntry produces a log entry that can be sent on a LogChan

type LogEntryWriter

type LogEntryWriter interface {
	io.Writer
}

LogEntryWriter is a type for implementing the io.Writer interface

func NewLogEntryWriter

func NewLogEntryWriter(ch LogChan) LogEntryWriter

NewLogEntryWriter returns a log entry writer initialized with the provided channel. The provided writer implements the io.Writer interface

type Reporter

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

Reporter is type for sending messages on log and/or status channels

func NewReporter

func NewReporter(log LogChan, event EventChan) *Reporter

NewReporter returns a reporter that is initialized with the provided channels

func (*Reporter) Event

func (r *Reporter) Event(opts EventOptions)

Event notifies the Reporter's EventChan that an event has occurred

func (*Reporter) Log

func (r *Reporter) Log(entry *logrus.Entry, message string)

Log - send a log message into the ether

func (*Reporter) LogLevel

func (r *Reporter) LogLevel(entry *logrus.Entry, message string, level logrus.Level)

LogLevel - send a log message into the ether, specifying level

Jump to

Keyboard shortcuts

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