progress

package
v0.0.0-...-442a4c8 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2018 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultChanBufferSize = 50000

DefaultChanBufferSize defines the number of progress events which can be buffered. If the buffer is full the next progress event will be dropped

Variables

View Source
var DefaultChan chan *Progress

Functions

This section is empty.

Types

type Percent

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

func NewPercent

func NewPercent(steps ...string) *Percent

func (*Percent) CatchProgress

func (perc *Percent) CatchProgress(pChan chan *Progress)

func (*Percent) ShowLogs

func (perc *Percent) ShowLogs()

func (*Percent) Start

func (perc *Percent) Start()

func (*Percent) Stop

func (perc *Percent) Stop()

type Progress

type Progress struct {
	Name         string
	Step         string
	Total        uint64
	Current      uint64
	ProgressChan chan *Progress
}

func (*Progress) Add

func (p *Progress) Add(n int64)

func (*Progress) Percent

func (p *Progress) Percent() float64

type Reader

type Reader struct {
	io.Reader
	Progress *Progress
}

It's proxy reader, implement io.Reader

func NewProgressReader

func NewProgressReader(rc io.Reader, name, step string, total uint64) *Reader

func (*Reader) Close

func (r *Reader) Close() (err error)

Close the reader when it implements io.Closer

func (*Reader) Read

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

Jump to

Keyboard shortcuts

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