progresslogger

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallEveryInterval

func CallEveryInterval(ctx context.Context, interval time.Duration, fn func()) context.CancelFunc

CallEveryInterval starts a goroutine that calls the provided function at regular intervals

Types

type BlockProgressTracker

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

BlockProgressTracker tracks the progress of a migration by block number.

func NewBlockProgressTracker

func NewBlockProgressTracker(
	name string,
	logger log.StructuredLogger,
	totalBlocks uint64,
	initialCompletedBlocks uint64,
) *BlockProgressTracker

NewBlockProgressTracker creates a new progress tracker for block-based migrations. initialCompletedBlocks allows resuming from a previous migration state.

func (*BlockProgressTracker) Elapsed

func (t *BlockProgressTracker) Elapsed() time.Duration

func (*BlockProgressTracker) IncrementCompletedBlocks

func (t *BlockProgressTracker) IncrementCompletedBlocks(amount uint64)

IncrementCompletedBlocks increments the completed blocks counter by the specified amount. Safe to call from multiple goroutines concurrently.

func (*BlockProgressTracker) LogProgress

func (t *BlockProgressTracker) LogProgress()

LogProgress logs the progress of the migration.

type Counter added in v0.17.0

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

func NewCounter added in v0.17.0

func NewCounter(logger log.StructuredLogger, timeLogRate time.Duration, phaseName string) Counter

func (*Counter) Log added in v0.17.0

func (c *Counter) Log(byteSize uint64, completedUnits, entryCount int)

func (*Counter) SetProgress added in v0.17.0

func (c *Counter) SetProgress(unit string, allUnits, allEntries uint64)

SetProgress names the work unit and declares how much of it there is, which turns on the percentage and total-runtime fields. Call it before the first Log; allUnits of zero leaves the extra fields off.

Jump to

Keyboard shortcuts

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