progress

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package progress is the estimate's progress lines, ported from the Node estimate's packages/estimate/src/progress.ts: discovery and phase 2's CloudWatch reads (requests, uptime). With a Status (a terminal), one line rewritten in place, redrawn every second; without (a log, CI), one line per account or region done and, every minute, those still read.

This package never writes an escape code or a carriage return: the terminal Status, with those, is the entry point's.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ticker

func Ticker(d time.Duration, fn func()) func()

Ticker is the default Every: a time.Ticker in a goroutine. Stop returns once the goroutine has ended, so fn does not run after it (do not call stop from fn).

Types

type Discovery

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

Discovery is the discovery phase's progress. Safe for concurrent use.

func DiscoveryView

func DiscoveryView(accounts int, o Options) *Discovery

DiscoveryView starts the view for the given number of accounts; call End when discovery is over.

func (*Discovery) Account

func (d *Discovery) Account(e discover.AccountEvent)

Account takes an account's started and done events (discover's AccountProgress).

func (*Discovery) End

func (d *Discovery) End()

End stops the redraws and leaves the last line.

func (*Discovery) Region

func (d *Discovery) Region(p discover.ProgressEvent)

Region takes a region's scanned event (discover's Progress).

type Every

type Every func(d time.Duration, fn func()) (stop func())

Every runs fn every d until the returned stop is called. The default never keeps the process alive.

type Options

type Options struct {
	Now    func() time.Time
	Log    func(line string)
	Status Status
	Every  Every
}

Options are what both views take. Zero Now, Log and Every get time.Now, a no-op and Ticker; a nil Status is not a terminal.

type Regions

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

Regions is phase 2's CloudWatch reads by region. Safe for concurrent use.

func RegionsView

func RegionsView(label string, o Options) *Regions

RegionsView starts the view for label "Requests" or "Uptime"; call End when the phase is over.

func (*Regions) Done

func (r *Regions) Done(p discover.ProgressEvent)

Done takes a region's read event (metrics' Progress).

func (*Regions) End

func (r *Regions) End()

End stops the redraws and, if there was anything to read, leaves the last line.

func (*Regions) Plan

func (r *Regions) Plan(count int)

Plan says how many regions are to be read (metrics' OnPlan).

func (*Regions) Start

func (r *Regions) Start(account, region string)

Start says a region's read began (metrics' OnStart).

type Status

type Status interface {
	Update(line string)
	End(line string)
}

Status is a line rewritten in place: Update redraws it, End leaves its last text.

Jump to

Keyboard shortcuts

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