Documentation
¶
Overview ¶
Package progress provides helpers to print progress status.
Index ¶
Constants ¶
View Source
const ( Bytes = Type("bytes") Duration = Type("duration") Gauge = Type("gauge") )
Type values.
Variables ¶
This section is empty.
Functions ¶
func MetricsStatus ¶
MetricsStatus renders Status metrics as a string.
Types ¶
type CountingReader ¶
CountingReader wraps io.Reader to count bytes.
func NewCountingReader ¶ added in v0.3.0
func NewCountingReader(r io.Reader) *CountingReader
NewCountingReader wraps an io.Reader with counters of bytes and lines.
func (*CountingReader) Bytes ¶
func (cr *CountingReader) Bytes() int64
Bytes returns number of processed bytes.
func (*CountingReader) Lines ¶
func (cr *CountingReader) Lines() int64
Lines returns number of processed lines.
type CountingWriter ¶
CountingWriter wraps io.Writer to count bytes.
func NewCountingWriter ¶ added in v0.3.0
func NewCountingWriter(w io.Writer) *CountingWriter
NewCountingWriter wraps an io.Writer with counters of bytes and lines.
func (*CountingWriter) Bytes ¶
func (cr *CountingWriter) Bytes() int64
Bytes returns number of processed bytes.
type MetricsExposer ¶
type MetricsExposer interface {
Metrics() []Metric
}
MetricsExposer provides metric counters.
type Progress ¶
type Progress struct {
Interval time.Duration
Print func(status Status)
ShowHeapStats bool
ShowLinesStats bool
// IncrementalSpeed shows speed and remaining estimate based on performance between two status updates.
IncrementalSpeed bool
// contains filtered or unexported fields
}
Progress reports reading performance.
func (*Progress) AddMetrics ¶
AddMetrics adds more metrics to progress status message.
type Status ¶ added in v0.2.0
type Status struct {
Task string `json:"task"`
DonePercent float64 `json:"done_percent"`
LinesCompleted int64 `json:"lines_completed"`
BytesCompleted int64 `json:"bytes_completed"`
SpeedMBPS float64 `json:"speed_mbps"`
SpeedLPS float64 `json:"speed_lps"`
Elapsed time.Duration `json:"-"`
Remaining time.Duration `json:"-"`
Metrics []Metric `json:"-"`
}
Status describes current progress.
Click to show internal directories.
Click to hide internal directories.