progress

package
v0.0.0-...-53483ec Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

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

A Counter tracks a running count and controls a goroutine that passes its value periodically to a Func.

The Func is also called when SIGUSR1 (or SIGINFO, on BSD) is received.

func New

func New(interval time.Duration, total uint64, report Func) *Counter

New starts a new Counter.

func (*Counter) Add

func (c *Counter) Add(v uint64)

Add v to the Counter. This method is concurrency-safe.

func (*Counter) Done

func (c *Counter) Done()

Done tells a Counter to stop and waits for it to report its final value.

func (*Counter) Get

func (c *Counter) Get() uint64

Get the current Counter value. This method is concurrency-safe.

func (*Counter) SetMax

func (c *Counter) SetMax(max uint64)

SetMax sets the maximum expected counter value. This method is concurrency-safe.

type Func

type Func func(value uint64, total uint64, runtime time.Duration, final bool)

A Func is a callback for a Counter.

The final argument is true if Counter.Done has been called, which means that the current call will be the last.

Jump to

Keyboard shortcuts

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