progress

package
v3.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

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

func (s *Scaler) OnProgress(percentage float64, message string)

OnProgress implements model.ExperimentCallbacks.

Jump to

Keyboard shortcuts

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