progress

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDiskInfo

func FormatDiskInfo(info *DiskInfo) string

FormatDiskInfo formats disk info as a compact string like "(nvme1n1p1) 630 GB / 1.5 TB (41%)"

func PrintBanner

func PrintBanner()

PrintBanner prints the Mithril ASCII art banner (left-aligned to match log output)

func PrintBuildInterrupted

func PrintBuildInterrupted(info BuildInterruptInfo)

PrintBuildInterrupted prints a summary box when build is stopped via Ctrl+C

func PrintDiskUsage

func PrintDiskUsage(accountsDbPath, blockstorePath, snapshotsPath string)

PrintDiskUsage prints a concise disk usage summary for configured paths

func PrintDownloadInterrupted

func PrintDownloadInterrupted(info DownloadInterruptInfo)

PrintDownloadInterrupted prints a summary box when download is stopped via Ctrl+C

func PrintShutdownSummary

func PrintShutdownSummary(info ShutdownInfo)

PrintShutdownSummary prints a summary box when replay is stopped via Ctrl+C

func PrintSnapshotSourceSummary

func PrintSnapshotSourceSummary(nodeIP string, slot int, referenceSlot int, nodeVersion string, speedMBs float64, rttMs int, searchDuration time.Duration)

PrintSnapshotSourceSummary prints a clean summary box for the selected snapshot source Box width = 80 chars to match Mithril banner (from left star edge to right star edge)

func PromptStaleAccountsDB

func PromptStaleAccountsDB(info StaleInfo) int

PromptStaleAccountsDB displays an interactive prompt when AccountsDB is significantly behind and returns the user's choice (1 = continue with AccountsDB, 2 = start fresh from snapshot)

Types

type BuildInterruptInfo

type BuildInterruptInfo struct {
	Stage          string // "downloading", "building", etc.
	SnapshotSlot   uint64
	SnapshotPath   string // path to downloaded snapshot if available
	AccountsDBPath string
}

BuildInterruptInfo contains information when build is interrupted

type DiskInfo

type DiskInfo struct {
	Label      string // e.g., "AccountsDB", "Snapshots", "Ledger"
	Path       string
	Device     string // e.g., "nvme1n1p1"
	UsedBytes  uint64
	TotalBytes uint64
	Error      error
}

DiskInfo holds information about disk usage for a specific path

func GetDiskInfo

func GetDiskInfo(path string) *DiskInfo

GetDiskInfo returns disk usage information for a given path

type DownloadInterruptInfo

type DownloadInterruptInfo struct {
	Stage           string // "downloading full snapshot", "downloading incremental", etc.
	SourceHost      string
	DownloadPercent float64
	BytesDownloaded int64
	TotalBytes      int64
}

DownloadInterruptInfo contains information when download is interrupted

type DualProgress

type DualProgress struct {
	Download *ProgressBar
	Extract  *ProgressBar
	// contains filtered or unexported fields
}

DualProgress manages two progress bars displayed simultaneously: - Download: compressed snapshot bytes from network - Extract: decompressed tar bytes (AppendVec files)

func NewDualProgress

func NewDualProgress() *DualProgress

NewDualProgress creates a new dual progress display

func (*DualProgress) Interrupt

func (d *DualProgress) Interrupt(err ...error)

Interrupt stops the progress display and shows interrupted status. If err is provided, shows the error message; otherwise shows "Interrupted by user".

func (*DualProgress) IsInterrupted

func (d *DualProgress) IsInterrupted() bool

IsInterrupted returns true if the progress was interrupted

func (*DualProgress) SetDownloadTotal

func (d *DualProgress) SetDownloadTotal(total int64)

SetDownloadTotal sets the known download total and enables dynamic estimation

func (*DualProgress) Start

func (d *DualProgress) Start()

Start begins the progress display update loop

func (*DualProgress) Stop

func (d *DualProgress) Stop()

Stop stops the progress display

type IndexingProgress

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

IndexingProgress tracks shard flush progress

func NewIndexingProgress

func NewIndexingProgress(label string) *IndexingProgress

NewIndexingProgress creates a new indexing progress display

func (*IndexingProgress) Finish

func (p *IndexingProgress) Finish()

Finish marks completion

func (*IndexingProgress) Interrupt

func (p *IndexingProgress) Interrupt(err ...error)

Interrupt shows interrupted status. If err is provided, shows the error message; otherwise shows "Interrupted".

func (*IndexingProgress) Start

func (p *IndexingProgress) Start(total int)

Start initializes the display with total count

func (*IndexingProgress) Update

func (p *IndexingProgress) Update(completed, total int)

Update updates progress and re-renders

type ProgressBar

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

ProgressBar tracks progress for a single operation

func NewProgressBar

func NewProgressBar(label string) *ProgressBar

NewProgressBar creates a new progress bar with the given label

func (*ProgressBar) Add

func (p *ProgressBar) Add(n int64)

Add increments the current progress by n bytes

func (*ProgressBar) Current

func (p *ProgressBar) Current() int64

Current returns the current progress

func (*ProgressBar) Render

func (p *ProgressBar) Render(useColor bool) string

Render returns the progress bar string

func (*ProgressBar) SetTotal

func (p *ProgressBar) SetTotal(total int64)

SetTotal sets the expected total bytes

func (*ProgressBar) Total

func (p *ProgressBar) Total() int64

Total returns the total expected

type ShutdownInfo

type ShutdownInfo struct {
	LastSlot         uint64
	LastBankhash     []byte
	SnapshotBaseSlot uint64
	AccountsDBPath   string
	ReplayDuration   time.Duration
	WasCancelled     bool
	RunID            string
	Epoch            uint64
	SnapshotEpoch    uint64
}

ShutdownInfo contains information about the replay state when shutting down

type StaleInfo

type StaleInfo struct {
	AccountsDBSlot     uint64
	LatestSnapshotSlot uint64
	SlotsBehind        uint64
}

StaleInfo contains information for the stale AccountsDB prompt

Jump to

Keyboard shortcuts

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