stream

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(dest io.Writer, src io.Reader) error

Copy copies the stream from the source to the destination in valid JSON format. This converts the logs, which are per-line JSON objects, to a proper JSON array.

func Create

func Create(c context.Context, key string) error

Create creates a new stream.

func Delete

func Delete(c context.Context, key string) error

Delete deletes the stream by key.

func Reader

func Reader(c context.Context, key string) (io.ReadCloser, error)

Reader opens the stream for reading.

func ToContext

func ToContext(c Setter, s Stream)

ToContext adds the Stream to this context if it supports the Setter interface.

func ToKey

func ToKey(i int64) string

ToKey is a helper function that converts a unique identifier of type int64 into a string.

func Writer

func Writer(c context.Context, key string) (io.WriteCloser, error)

Writer opens the stream for writing.

Types

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

type Stream

type Stream interface {
	Create(string) error
	Delete(string) error
	Reader(string) (io.ReadCloser, error)
	Writer(string) (io.WriteCloser, error)
}

Stream manages the stream of build logs.

func FromContext

func FromContext(c context.Context) Stream

FromContext returns the Stream associated with this context.

func New

func New() Stream

New returns a new in-memory implementation of Stream.

Jump to

Keyboard shortcuts

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