Skip to content
pkg
progress

progress

Explore the following sections to learn more:

progress

import "github.com/gemini-oss/rego/pkg/common/progress"

pkg/common/progress/progress.go

Index

type ActiveFolderUpdate

ActiveFolderUpdate represents an update to the active folders list

type ActiveFolderUpdate struct {
    Path   string // Folder path
    Action string // "add" or "remove"
}

type HierarchicalTracker

HierarchicalTracker displays multi-line progress for hierarchical operations Uses save/restore cursor with separators for stable rendering Line 1: Spinner with total files/folders found and elapsed time Line 2: Progress bar showing completion of top-level items Line 3: Current path being processed Lines 4+: Currently active folders being scanned (up to maxActiveFolders)

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

func NewHierarchical

func NewHierarchical(label string, topLevelTotal int) *HierarchicalTracker

NewHierarchical creates a new hierarchical progress tracker with alternate screen mode (default) label: The operation label to display topLevelTotal: The number of top-level items to track (for progress bar)

func NewHierarchicalWithMode

func NewHierarchicalWithMode(label string, topLevelTotal int, mode TrackerMode) *HierarchicalTracker

NewHierarchicalWithMode creates a new hierarchical progress tracker with specified mode label: The operation label to display topLevelTotal: The number of top-level items to track (for progress bar) mode: ModeAltScreen for separate screen, ModeScrollRegion for sticky header with logs below

func (*HierarchicalTracker) ActiveFolderCount

func (t *HierarchicalTracker) ActiveFolderCount() int

ActiveFolderCount returns the number of currently active folders

func (*HierarchicalTracker) AddActiveFolder

func (t *HierarchicalTracker) AddActiveFolder(path string)

AddActiveFolder marks a folder as currently being scanned

func (*HierarchicalTracker) Done

func (t *HierarchicalTracker) Done()

Done stops the tracker and displays completion

func (*HierarchicalTracker) Elapsed

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

Elapsed returns the duration since tracking started

func (*HierarchicalTracker) FoldersScanned

func (t *HierarchicalTracker) FoldersScanned() int64

FoldersScanned returns the current count of folders scanned

func (*HierarchicalTracker) GetStats

func (t *HierarchicalTracker) GetStats() TrackerStats

GetStats returns a snapshot of all current statistics (thread-safe)

func (*HierarchicalTracker) ItemsFound

func (t *HierarchicalTracker) ItemsFound() int64

ItemsFound returns the current count of items found

func (*HierarchicalTracker) RemoveActiveFolder

func (t *HierarchicalTracker) RemoveActiveFolder(path string)

RemoveActiveFolder marks a folder as no longer being scanned

func (*HierarchicalTracker) SetTopLevelTotal

func (t *HierarchicalTracker) SetTopLevelTotal(total int)

SetTopLevelTotal updates the total number of top-level items Call this after the first API response reveals the count

func (*HierarchicalTracker) Start

func (t *HierarchicalTracker) Start()

Start begins displaying progress. Call this in a goroutine.

func (*HierarchicalTracker) Summary

func (t *HierarchicalTracker) Summary() string

Summary returns a human-readable summary string of current progress Useful for checkpoint logging

func (*HierarchicalTracker) TopLevelProgress

func (t *HierarchicalTracker) TopLevelProgress() (int, int)

TopLevelProgress returns the current top-level progress (complete, total)

func (*HierarchicalTracker) Update

func (t *HierarchicalTracker) Update(itemsFound, foldersScanned int64, currentPath string, topLevelComplete int)

Update sends a progress update to the tracker

type HierarchicalUpdate

HierarchicalUpdate represents a progress update for hierarchical operations

type HierarchicalUpdate struct {
    ItemsFound       int64  // Total items found across all levels
    FoldersScanned   int64  // Total folders scanned
    CurrentPath      string // Current item being processed
    TopLevelComplete int    // Number of top-level items completed
}

type IndeterminateTracker

IndeterminateTracker displays progress for operations with unknown totals It shows a spinner, item count, current path, and elapsed time

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

func NewIndeterminate

func NewIndeterminate(label string) *IndeterminateTracker

NewIndeterminate creates a new indeterminate progress tracker with default mode (simple line) label: The operation label to display (e.g., “Scanning Drive”)

func NewIndeterminateWithMode

func NewIndeterminateWithMode(label string, mode TrackerMode) *IndeterminateTracker

NewIndeterminateWithMode creates a new indeterminate progress tracker with specified mode label: The operation label to display mode: ModeAltScreen for separate screen, ModeScrollRegion for sticky header with logs below

func (*IndeterminateTracker) Done

func (t *IndeterminateTracker) Done()

Done stops the tracker and displays a completion message

func (*IndeterminateTracker) Elapsed

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

Elapsed returns the elapsed time since tracking started

func (*IndeterminateTracker) ItemsFound

func (t *IndeterminateTracker) ItemsFound() int64

ItemsFound returns the current count of items found (thread-safe)

func (*IndeterminateTracker) Start

func (t *IndeterminateTracker) Start()

Start begins displaying progress. Call this in a goroutine. Example: go tracker.Start()

func (*IndeterminateTracker) Update

func (t *IndeterminateTracker) Update(itemsFound int64, currentPath string)

Update sends a progress update to the tracker

type TrackerMode

TrackerMode defines how the progress tracker renders

type TrackerMode int

const (
    // ModeAltScreen uses alternate screen buffer (tracker gets its own screen)
    ModeAltScreen TrackerMode = iota
    // ModeScrollRegion uses scroll regions (tracker at top, logs scroll below)
    ModeScrollRegion
)

type TrackerStats

Stats returns a snapshot of all current statistics

type TrackerStats struct {
    ItemsFound       int64
    FoldersScanned   int64
    TopLevelComplete int
    TopLevelTotal    int
    ActiveFolders    int
    Elapsed          time.Duration
    Rate             float64 // items per minute
}

type Update

Update represents a progress update message

type Update struct {
    ItemsFound  int64  // Count of items processed so far
    CurrentPath string // Current item being processed (e.g., folder path)
}

Generated by gomarkdoc