progress

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	syncutil.RWMutex
	// contains filtered or unexported fields
}

Manager is used to maintain the progresses we care about.

func NewManager

func NewManager() *Manager

NewManager creates a new Manager.

func (*Manager) AddProgress

func (m *Manager) AddProgress(progress string, current, total float64, updateInterval time.Duration) (exist bool)

AddProgress adds a progress into manager if it doesn't exist.

func (*Manager) GetProgresses

func (m *Manager) GetProgresses(filter func(p string) bool) []string

GetProgresses gets progresses according to the filter.

func (*Manager) RemoveProgress

func (m *Manager) RemoveProgress(progress string) (exist bool)

RemoveProgress removes a progress from manager.

func (*Manager) Reset

func (m *Manager) Reset()

Reset resets the progress manager.

func (*Manager) Status

func (m *Manager) Status(progress string) (process, leftSeconds, currentSpeed float64, err error)

Status returns the current progress status of a give name.

func (*Manager) UpdateProgress

func (m *Manager) UpdateProgress(progress string, current, remaining float64, isInc bool)

UpdateProgress updates the progress if it exists.

func (*Manager) UpdateProgressTotal

func (m *Manager) UpdateProgressTotal(progress string, total float64)

UpdateProgressTotal updates the total value of a progress if it exists.

Jump to

Keyboard shortcuts

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