progresslogger

package
v0.17.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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