Documentation ¶
Overview ¶
Package progress contains utilities to emit progress.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scaler ¶
type Scaler struct {
// contains filtered or unexported fields
}
Scaler implements model.ExperimentCallbacks and scales progress as instructed through the NewScaler constructor.
The *Scaler is safe to use from multiple goroutine contexts.
func NewScaler ¶
func NewScaler(callbacks model.ExperimentCallbacks, offset, total float64) *Scaler
NewScaler constructs a new *Scaler using the given offset and total and emitting progress using the given model.ExperimentCallbacks.
The offset is added to each progress value we emit. The total is used to scale the 100% to a suitable subset.
For example, with offset equal to 0.1 and total equal to 0.5, the value 0.5 corresponds to 0.3 and the value 1 (i.e., 100%) is 0.5.
This func PANICS if offset<0, offset >= total, total<=0, total>1.
func (*Scaler) OnProgress ¶
OnProgress implements model.ExperimentCallbacks.