streamtrace

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package streamtrace counts what the streamed execution of xsl:source-document did, so the differential tests can say how many containers took the streamed path, by which strategy, how many fell back to the tree, and whether a guard ever fired. It also holds the switches that turn streaming off for a whole run (tests/streamdiff's third leg) and that stop a container that fails while streaming from running again on the tree (its fourth, the norerun leg).

It is compiled into the engine but only tests read it; the counters are process-wide atomics, so a reader takes a Snapshot before and after the work it wants to attribute and subtracts. Nothing here may change a result.

Index

Constants

View Source
const FirstFailure = ", the first failure detected: "

FirstFailure is what a streamed input's validation error says between its subject and the failure it reports (xslt/streamvalidin.go): the first one the stream met, where the tree's text lists every failure of the document.

Variables

This section is empty.

Functions

func Fallback

func Fallback()

Fallback counts one select of a streamed run evaluated on the tree after an error, the run going on.

func Guard

func Guard()

Guard counts one hit of a runtime guard: a streamed run that met something the static gate should have kept off the streamed path. The posture guard of xdm's views counts here (PostureError); the count must stay 0, and tests/streamdiff fails when it is not.

func NoRerun

func NoRerun() bool

NoRerun reports whether re-runs are switched off: a container that fails while streaming returns its streamed error instead of running again on the tree. Rerun still counts it.

func Node

func Node(k Kind, n int64)

Node counts n sNodes of kind k in a container run by the core.

func Off

func Off() bool

Off reports whether streaming is switched off: every container takes the tree path, as with xslt's noBursts.

func Rerun

func Rerun()

Rerun counts one container the streamed core ran again on the tree (or, under NoRerun, would have).

func Run

func Run(s Strategy)

Run counts one container run on the streamed path.

func SameError

func SameError(streamed, tree string) bool

SameError reports whether streamed, the error text of a streamed run, is the tree's, tree, as the differential tests compare them: the same text, or, for the one family judged by code, the same code.

The family is the invalidity of an input document found by validating it (xsl:source-document's validation="strict" or type=): XTTE1510 or XTTE1540, the streamed text marked with FirstFailure. The tree validates the whole document before its body runs and lists every failure; the stream stops at the first. XSLT 3.0 §2.14: "If more than one error arises, an implementation is not required to signal any errors other than the first one that it detects. It is implementation-dependent which of the several errors is signaled." Every other error is compared in full.

func SetNoRerun

func SetNoRerun(b bool)

SetNoRerun switches re-runs off (true) or back on.

func SetOff

func SetOff(b bool)

SetOff switches streaming off (true) or back on.

Types

type Counts

type Counts struct {
	Runs      [NumStrategies]int64
	Kinds     [NumKinds]int64
	Fallbacks int64
	Guards    int64
	Reruns    int64
}

Counts is a reading of the counters.

func Snapshot

func Snapshot() Counts

Snapshot reads the counters.

func (Counts) Streamed

func (c Counts) Streamed() int64

Streamed is the number of container runs on the streamed path.

func (Counts) Sub

func (c Counts) Sub(d Counts) Counts

Sub is c minus an earlier reading d: what happened in between.

type Kind

type Kind int

Kind is a kind of sNode of the streamed core's plan (DESIGN section 1.6), plus Select, a value-of, copy-of, sequence or attribute whose select is split (the consuming operand of DESIGN's sElement), and Apply, an xsl:apply-templates, xsl:next-match or xsl:apply-imports run on the cursor (DESIGN's sApply).

const (
	KindTree Kind = iota
	KindGround
	KindSeq
	KindElement
	KindChoose
	KindForEach
	KindWherePop
	KindSourceDoc
	KindSelect
	KindApply
	// KindGroup is a streamed xsl:for-each-group (xslt/streamgroup.go).
	KindGroup
	// KindFork is an xsl:fork or xsl:map whose prongs each read the
	// document, on a cursor of their own (xslt/streamfork.go).
	KindFork
	NumKinds
)

func (Kind) String

func (k Kind) String() string

type PostureError

type PostureError struct{ Op, Kind string }

PostureError is the panic a posture guard raises: a streamed node was asked for what its posture does not have (Op, such as "children", of a node of kind Kind). The streamed executor recovers it and runs the container on the tree instead; Guard has counted it.

func (*PostureError) Error

func (e *PostureError) Error() string

type Strategy

type Strategy int

Strategy is how one streamed container run was executed.

const (
	// Core is a container run by the streamed core (xslt/streamexec.go):
	// its plan is a tree of sNodes, counted by Kind. (The burst plans' four
	// strategies, fold, collect, for-each and iterate, were retired into it.)
	Core Strategy = iota
	// Main is a principal input streamed by xslt's TransformReader
	// (xslt/streammain.go): the initial mode's dispatch of the document
	// node, run on the cursor as the core runs an apply op.
	Main
	// Merge is an xsl:merge whose streamable sources are each read on a
	// cursor of their own (xslt/streammerge.go).
	Merge
	NumStrategies
)

func (Strategy) String

func (s Strategy) String() string

Jump to

Keyboard shortcuts

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