Documentation
¶
Overview ¶
Package passthru provides Reader and Writer with information about the amount of data being passed.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNilReader = errors.New("Reader is nil") ErrNilWriter = errors.New("Writer is nil") )
Functions ¶
This section is empty.
Types ¶
type Calculator ¶
type Calculator struct {
// contains filtered or unexported fields
}
Calculator calculates pass-thru speed and remaining time
func NewCalculator ¶
func NewCalculator(total int64, winSizeSec float64) *Calculator
NewCalculator creates new Calculator struct
func (*Calculator) Calculate ¶
func (c *Calculator) Calculate(current int64) (float64, time.Duration)
Calculate calculates speed and remaining time
func (*Calculator) SetTotal ¶
func (c *Calculator) SetTotal(total int64)
SetTotal sets total number of objects
type Reader ¶
type Reader struct { Calculator *Calculator Update func(n int) // contains filtered or unexported fields }
Reader is pass-thru Reader
func NewReader ¶
func NewReader(reader io.ReadCloser, total int64) *Reader
NewReader creates new passthru reader
type Writer ¶
type Writer struct { Calculator *Calculator Update func(n int) // contains filtered or unexported fields }
Writer is pass-thru Writer
func NewWriter ¶
func NewWriter(writer io.WriteCloser, total int64) *Writer
NewWriter creates new passthru writer
Click to show internal directories.
Click to hide internal directories.