Documentation
¶
Overview ¶
Package progress provides the shared progress-logging and resumable checkpoint helpers used by every cryptolab tool: throttled structured logging for high-volume search loops, an append-only JSONL survivor log, and an atomically-written JSON checkpoint so multi-hour runs survive a kill and resume where they left off.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadCheckpoint ¶
LoadCheckpoint reads a checkpoint into v. A missing file is not an error (found is false), so callers can treat "no checkpoint" as "start fresh".
func SaveCheckpoint ¶
SaveCheckpoint atomically writes v as pretty JSON to path (temp file in the same directory + rename), so a killed process never leaves a half-written checkpoint.
Types ¶
type JSONL ¶
type JSONL struct {
// contains filtered or unexported fields
}
JSONL is an append-only newline-delimited JSON writer for survivor logs.
func OpenJSONL ¶
OpenJSONL creates/truncates a .jsonl file at dir/name. A nil JSONL (when dir is empty) is safe to Append to and Close — it no-ops.
type Throttle ¶
type Throttle struct {
Logger *slog.Logger
Msg string
Every int // emit at most once per this many ticks (0 = no count gate)
Interval time.Duration // emit at most once per this duration (0 = no time gate)
// contains filtered or unexported fields
}
Throttle rate-limits high-volume progress lines. A search loop that visits millions of candidates calls Tick every iteration but only emits a log line every Every iterations or every Interval, whichever comes first — plus an unconditional line whenever the caller reports a new best.