event

package
Version: v0.0.0-...-afaf855 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWriter

func NewWriter(emitter Emitter, origin Origin) io.Writer

Types

type Emitter

type Emitter interface {
	EmitEvent(Event)
	Close()
}

type End

type End struct{}

func (End) EventType

func (End) EventType() EventType

type Error

type Error struct {
	Message string `json:"message"`
	Origin  Origin `json:"origin,omitempty"`
}

func (Error) EventType

func (Error) EventType() EventType

type Event

type Event interface {
	EventType() EventType
}

func ParseEvent

func ParseEvent(t EventType, payload []byte) (Event, error)

type EventType

type EventType string
const (
	EventTypeInvalid EventType = ""

	// event stream protocol version
	EventTypeVersion EventType = "version"

	// end of stream
	EventTypeEnd EventType = "end"

	// build log (e.g. from input or build execution)
	EventTypeLog EventType = "log"

	// build status change (e.g. 'started', 'succeeded')
	EventTypeStatus EventType = "status"

	// build initializing (all inputs fetched; fetching image)
	EventTypeInitialize EventType = "initialize"

	// build execution started
	EventTypeStart EventType = "start"

	// build execution finished
	EventTypeFinish EventType = "finish"

	// error occurred
	EventTypeError EventType = "error"

	// input fetched
	EventTypeInput EventType = "input"

	// output completed
	EventTypeOutput EventType = "output"
)

type Finish

type Finish struct {
	Time       int64 `json:"time"`
	ExitStatus int   `json:"exit_status"`
}

func (Finish) EventType

func (Finish) EventType() EventType

type Hub

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

func NewHub

func NewHub() *Hub

func (*Hub) Close

func (h *Hub) Close()

func (*Hub) EmitEvent

func (h *Hub) EmitEvent(event Event)

func (*Hub) Events

func (h *Hub) Events() []Event

func (*Hub) Subscribe

func (h *Hub) Subscribe(from uint, events chan<- Event, stop <-chan struct{})

type Initialize

type Initialize struct {
	BuildConfig turbine.Config `json:"config"`
}

func (Initialize) EventType

func (Initialize) EventType() EventType

type Input

type Input struct {
	Input turbine.Input `json:"input"`
}

func (Input) EventType

func (Input) EventType() EventType

type Log

type Log struct {
	Origin  Origin `json:"origin"`
	Payload string `json:"payload"`
}

func (Log) EventType

func (Log) EventType() EventType

type Message

type Message struct {
	Event Event `json:"-"`
}

func (Message) MarshalJSON

func (m Message) MarshalJSON() ([]byte, error)

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(bytes []byte) error

type Origin

type Origin struct {
	Type OriginType `json:"type"`
	Name string     `json:"name"`
}

not an event; used in Log and Error

type OriginType

type OriginType string
const (
	OriginTypeInvalid OriginType = ""
	OriginTypeInput   OriginType = "input"
	OriginTypeOutput  OriginType = "output"
	OriginTypeRun     OriginType = "run"
)

type Output

type Output struct {
	Output turbine.Output `json:"output"`
}

func (Output) EventType

func (Output) EventType() EventType

type Start

type Start struct {
	Time int64 `json:"time"`
}

func (Start) EventType

func (Start) EventType() EventType

type Status

type Status struct {
	Status turbine.Status `json:"status"`
	Time   int64          `json:"time"`
}

func (Status) EventType

func (Status) EventType() EventType

type Version

type Version string
const CURRENT_VERSION Version = "1.1"

func (Version) EventType

func (Version) EventType() EventType

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL