broadcaster

package
v1.9.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffered

type Buffered struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Buffered keeps track of one or more observers watching the progress of an operation. For example, if multiple clients are trying to pull an image, they share a Buffered struct for the download operation.

func NewBuffered

func NewBuffered() *Buffered

NewBuffered returns an initialized Buffered structure.

func (*Buffered) Add

func (broadcaster *Buffered) Add(w io.Writer) error

Add adds an observer to the broadcaster. The new observer receives the data from the history buffer, and also all subsequent data.

func (*Buffered) Close

func (broadcaster *Buffered) Close()

Close signals to all observers that the operation has finished. It causes all calls to Wait to return nil.

func (*Buffered) CloseWithError

func (broadcaster *Buffered) CloseWithError(result error)

CloseWithError signals to all observers that the operation has finished. Its argument is a result that should be returned to waiters blocking on Wait.

func (*Buffered) Wait

func (broadcaster *Buffered) Wait() error

Wait blocks until the operation is marked as completed by the Close method, and all writer goroutines have completed. It returns the argument that was passed to Close.

func (*Buffered) Write

func (broadcaster *Buffered) Write(p []byte) (n int, err error)

Write adds data to the history buffer, and also writes it to all current observers.

type Unbuffered

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

Unbuffered accumulates multiple io.WriteCloser by stream.

func (*Unbuffered) Add

func (w *Unbuffered) Add(writer io.WriteCloser)

Add adds new io.WriteCloser.

func (*Unbuffered) Clean

func (w *Unbuffered) Clean() error

Clean closes and removes all writers. Last non-eol-terminated part of data will be saved.

func (*Unbuffered) Write

func (w *Unbuffered) Write(p []byte) (n int, err error)

Write writes bytes to all writers. Failed writers will be evicted during this call.

Jump to

Keyboard shortcuts

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