Documentation
¶
Overview ¶
Package progressreader provides a Reader with a progress bar that can be printed out using the streamformatter package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
Broadcaster 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 Broadcaster for the download operation.
func NewBroadcaster ¶
func NewBroadcaster() *Broadcaster
NewBroadcaster returns a Broadcaster structure
func (*Broadcaster) Add ¶
func (broadcaster *Broadcaster) 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 (*Broadcaster) Close ¶
func (broadcaster *Broadcaster) Close()
Close signals to all observers that the operation has finished. It causes all calls to Wait to return nil.
func (*Broadcaster) CloseWithError ¶
func (broadcaster *Broadcaster) 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 (*Broadcaster) Wait ¶
func (broadcaster *Broadcaster) 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.
type Config ¶
type Config struct {
In io.ReadCloser // Stream to read from
Out io.Writer // Where to send progress bar to
Formatter *streamformatter.StreamFormatter
Size int64
Current int64
LastUpdate int64
NewLines bool
ID string
Action string
}
Config contains the configuration for a Reader with progress bar.