observation

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MPL-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package observation defines cheap typed work milestones. Producers report actual work; consumers own scheduling and presentation.

Index

Constants

View Source
const (
	// Preparation resolves instructions, destinations and required resources.
	Preparation Phase = 0
	// InputInspection captures and inspects sources, which can overlap.
	InputInspection Phase = 1
	// Layout measures or renders distinct generated specifications.
	Layout Phase = 2
	// Assembly imports source occurrences and compiles output pages.
	Assembly Phase = 3
	// Optimization enters the backend optimizer.
	Optimization Phase = 4
	// OutputWriting writes the staged PDF once.
	OutputWriting Phase = 5
	// OutputVerification reads and verifies the staged output.
	OutputVerification Phase = 6
	// Publication stages and publishes requested deliverables.
	Publication Phase = 7
	// Finalization includes workspace cleanup and report salvage.
	Finalization Phase = 8
	// PhaseCount bounds consumer state; it is not a valid phase.
	PhaseCount Phase = 9

	// UnitNone denotes an indeterminate milestone without a counter.
	UnitNone Unit = 0
	// CapturedSources counts successfully captured distinct PDF sources.
	CapturedSources Unit = 1
	// ProcessedSources counts returned source attempts, including failures.
	ProcessedSources Unit = 2
	// ProcessedGeneratedSpecs counts returned layout/render spec attempts.
	ProcessedGeneratedSpecs Unit = 3
	// ImportedSources counts actual successful source-document imports,
	// including per-occurrence reimports but excluding generated resources.
	ImportedSources Unit = 4
	// CompiledPages counts actual output-page placements.
	CompiledPages Unit = 5
	// UnitCount bounds consumer state; it is not a valid unit.
	UnitCount Unit = 6
)

Variables

This section is empty.

Functions

func Emit

func Emit(observer Observer, milestone Milestone)

Emit sends a cheap milestone when the consumer has requested observations.

Types

type Milestone

type Milestone struct {
	Completed  int64
	Total      int64
	Phase      Phase
	Unit       Unit
	TotalKnown bool
	Advance    bool
}

Milestone is a phase boundary or an actual cumulative work observation. UnitNone has no counter. Total is meaningful only when TotalKnown is true. Advance marks a real work milestone without a measurable counter.

type Observer

type Observer interface{ Observe(milestone Milestone) }

Observer accepts a milestone without waiting for presentation or I/O.

type Phase

type Phase uint8

Phase is a once-entered, monotonic boundary in a build or check.

func (Phase) String

func (phase Phase) String() string

String returns the stable phase name.

type Unit

type Unit uint8

Unit identifies exactly what a cumulative count measures.

func (Unit) String

func (unit Unit) String() string

String returns the stable scoped counter name.

Jump to

Keyboard shortcuts

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