progress

package
v1.4.2-0...-bb2c923 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Message

func Message(out Output, id, message string)

Message is a convenience function to write a progress message to the channel.

func Messagef

func Messagef(out Output, id, format string, a ...interface{})

Messagef is a convenience function to write a printf-formatted progress message to the channel.

func Update

func Update(out Output, id, action string)

Update is a convenience function to write a progress update to the channel.

func Updatef

func Updatef(out Output, id, format string, a ...interface{})

Updatef is a convenience function to write a printf-formatted progress update to the channel.

Types

type Output

type Output interface {
	WriteProgress(Progress) error
}

Output is an interface for writing progress information. It's like a writer for progress, but we don't call it Writer because that would be confusing next to ProgressReader (also, because it doesn't implement the io.Writer interface).

func ChanOutput

func ChanOutput(progressChan chan<- Progress) Output

ChanOutput returns a Output that writes progress updates to the supplied channel.

type Progress

type Progress struct {
	ID string

	// Progress contains a Message or...
	Message string

	// ...progress of an action
	Action  string
	Current int64
	Total   int64

	LastUpdate bool
}

Progress represents the progress of a transfer.

type Reader

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

Reader is a Reader with progress bar.

func NewProgressReader

func NewProgressReader(in io.ReadCloser, out Output, size int64, id, action string) *Reader

NewProgressReader creates a new ProgressReader.

func (*Reader) Close

func (p *Reader) Close() error

Close closes the progress reader and its underlying reader.

func (*Reader) Read

func (p *Reader) Read(buf []byte) (n int, err error)

Jump to

Keyboard shortcuts

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