Help us shape the future of Go! Take the 2026 Go Developer Survey

progress

package
v1.0.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package progress owns bounded, ephemeral progress feeds. Persistence and HTTP presentation belong to callers; feeds know nothing about AppTown or its database.

Index

Constants

View Source
const MaxLines = 500

Variables

This section is empty.

Functions

This section is empty.

Types

type Feeds

type Feeds struct {
	// Now is the feeds' clock, for a feed's elapsed time; nil is the real
	// clock.
	Now func() time.Time
	// contains filtered or unexported fields
}

Feeds is ready to use at its zero value. Do not copy it after first use.

func (*Feeds) Append

func (f *Feeds) Append(id ids.ID, lines ...string)

func (*Feeds) Discard

func (f *Feeds) Discard(id ids.ID)

func (*Feeds) Finish

func (f *Feeds) Finish(id ids.ID) (Snapshot, bool)

Finish removes the feed and returns its final tail for optional persistence. Appends after removal are ignored until another Start for the same ID.

func (*Feeds) Heartbeat

func (f *Feeds) Heartbeat(stepID ids.ID, phase string) func()

Heartbeat opens a live feed for a long, output-silent step and ticks an elapsed line every few seconds, so a deploy or scan that prints nothing for 40s stops looking hung (complaint #3). The feed also carries elapsed time to the UI header and `apptown watch`; it vanishes when the returned stop func runs — ephemeral sign-of-life, never part of the ledger. Safe to stop more than once.

func (*Feeds) Read

func (f *Feeds) Read(id ids.ID, from int) (Snapshot, bool)

Read returns lines after an absolute offset, clamped to the retained tail.

func (*Feeds) Start

func (f *Feeds) Start(id ids.ID)

type Snapshot

type Snapshot struct {
	Lines     []string
	Total     int
	ElapsedMs int64
}

Snapshot is a detached copy; callers may retain or edit Lines safely.

Jump to

Keyboard shortcuts

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