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 ¶
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 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 SameError ¶
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.
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.
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 )
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 )