progress

package
v0.0.0-...-d2d682e Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package progress implements a thread-safe progress mechanism which will be used in crawler to keep track of the progress.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Progress

type Progress struct {
	Lock    sync.Mutex
	PageNum int
	Bar     *progressbar.ProgressBar
}

Progress contains a mutex to ensure thread-safety, PageNum for keeping track of the number of the processed pages, and a progress bar for CLI.

func New

func New(max int) *Progress

New initializes and returns a Progress. It uses default progressbar config.

func (*Progress) Add

func (p *Progress) Add(delta int)

Add adds delta to the progress.

func (*Progress) Current

func (p *Progress) Current() int

Current returns the current number of pages processed.

Jump to

Keyboard shortcuts

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