Documentation
¶
Index ¶
- Variables
- func Publish(ctx context.Context, event Event) error
- func ReportError(ctx context.Context, stage Stage, err error)
- func ReportMessage(ctx context.Context, stage Stage, message string)
- func ReportStage(ctx context.Context, stage Stage)
- func WithPublisher(ctx context.Context, pub Publisher) context.Context
- type Event
- type Publisher
- type Stage
Constants ¶
This section is empty.
Variables ¶
var ErrPublisherClosed = errors.New("progress publisher closed")
Functions ¶
func Publish ¶
Publish emits a progress event to the context-bound publisher. Returns an error if publishing fails (context canceled, publisher closed, etc.). Most callers should use the Report* helpers which ignore errors.
func ReportError ¶
ReportError emits a stage event with an error message. This is useful for communicating non-fatal errors during batching or pagination so users can decide whether to cancel or continue. Errors are silently ignored per the package error handling policy.
func ReportMessage ¶
ReportMessage emits a stage event with a descriptive message. Errors are silently ignored per the package error handling policy.
func ReportStage ¶
ReportStage emits a stage transition event. Errors are silently ignored per the package error handling policy.
Types ¶
type Publisher ¶
Publisher emits progress events to interested listeners.
func NewChannelPublisher ¶
type Stage ¶
type Stage string
Stage identifies the conceptual phase of an operation emitting progress events.
const ( // StagePrepare indicates the preparation phase before main work begins. // Used for validation, configuration loading, and setup tasks. StagePrepare Stage = "prepare" // StageFetch indicates network or I/O operations to retrieve data. // Used for API calls, database queries, and file reads. StageFetch Stage = "fetch" // StageProcess indicates computation or transformation of data. // Used for parsing, filtering, aggregation, and business logic. StageProcess Stage = "process" // StageRender indicates formatting and output of results. // Used for template rendering, serialization, and display preparation. StageRender Stage = "render" )