Documentation
¶
Overview ¶
Package record generates the SysML declarations that record an analysis run, a sweep or a Monte-Carlo sample into the model it ran on, as usages of the bundled AnalysisRecords library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attributes ¶ added in v0.11.0
Attributes are the features a record definition declares, by name, each with whether it is a reference and the name of its declared type.
Types ¶
type Existing ¶
type Existing struct {
// Package marks the target package already declared.
Package bool
// Definition marks the per-case record definition already declared in it.
Definition bool
// Attributes are the features the existing definition declares, by name.
Attributes map[string]Feature
// Taken are the N for which <case>_runN is already declared in the package.
Taken map[int]bool
// Stem is the name the records and their definition are built on — the
// case's short name, or an owner-prefixed fallback a sibling case's
// definition forced.
Stem string
}
Existing is what Generate must fit the records it makes into.
type Feature ¶
type Feature struct {
// Ref marks a `ref part`, an object-valued feature; unset is an attribute.
Ref bool
// TypeFQN is the qualified name of the feature's declared type.
TypeFQN string
// Multi marks a feature whose declared multiplicity admits more than one
// value.
Multi bool
// Unique marks a multi-valued feature that holds no two equal values.
Unique bool
}
Feature is one member an existing record definition declares.
type Kind ¶
type Kind string
Kind is the run shape a record's `kind` feature reports.
const ( // KindRun records one run of an analysis case. KindRun Kind = "run" // KindTrade records one run of an analysis case that evaluated alternatives. KindTrade Kind = "trade" // KindSweep records the runs of a sweep. KindSweep Kind = "sweep" // KindRuns records the runs of a Monte-Carlo sample. KindRuns Kind = "runs" // KindSample records the conclusion a Monte-Carlo sample made, beside the // runs it was made of. KindSample Kind = "sample" )
type Placement ¶ added in v0.11.0
Placement is where a case's records go: the package, the case's declared name, and what the package already holds of the shape Generate must fit.
type Provenance ¶
type Provenance struct {
// RunAt is when the run was made; recorded in UTC.
RunAt time.Time
// Tool names the program that ran it.
Tool string
// Command is the invocation text that ran it.
Command string
// Kind is the run shape the records report.
Kind Kind
}
Provenance is what a recorded run reports about how it was made.
type Request ¶
type Request struct {
// Package is the qualified name of the package the records go into, e.g.
// "Records" or "Mission::Records".
Package string
// Case is the qualified name of the analysis case the runs were made of.
Case string
// CaseName is the case's declared name as written, quoting needs included;
// the records and their definition are named from it. Empty falls back to
// Case's last qualified-name segment.
CaseName string
// Provenance is what every record reports about how it was made.
Provenance Provenance
// Runs are the runs to record, in order.
Runs []Run
// Existing is what the target package already holds.
Existing Existing
}
Request is one call to Generate.
type Result ¶
type Result struct {
// Source is the declaration text: the target package's full nesting down to
// it, holding the record definition when new and every record usage.
Source string
// Definition is the qualified name of the per-case record definition.
Definition string
// Records are the qualified names of the record usages, in order.
Records []string
}
Result is what Generate made.
type Run ¶
type Run struct {
// Iteration is the run's position in a sweep or sample; 0 for a single run.
Iteration int
// Subject is the object the run was made on.
Subject Subject
// Inputs are the values the run bound the case's input parameters to.
Inputs []runtime.InputBinding
// Outputs are the values the run's declared outputs came to.
Outputs []runtime.CalcOutputValue
// Verdicts are what the run's checks decided.
Verdicts []runtime.AnalysisVerdict
// Evaluations are the calc applications the run made.
Evaluations []runtime.AnalysisEvaluation
// Kind is the run shape this record makes; empty, the request's kind.
Kind Kind
// Verifications are what a verification case's body and its subcases
// decided, for a case that is one.
Verifications []runtime.VerificationVerdict
// Tools is what every external tool call this run made ran, in call order.
Tools []string
// Spell renders the run's values for the text it cannot supply itself, in
// the context it was made in — a sweep's rows each carry their own.
Spell Spelling
}
Run is everything one run of a case contributes to its record.
type Spelling ¶
type Spelling struct {
// ObjectUsage is the qualified name of the usage an object value is an
// occurrence of, or "" when the value names no single usage.
ObjectUsage func(v runtime.Value) string
// Text is a value's text for the surfaces that record it as a string.
Text func(v runtime.Value) string
// Unset reports a value records nothing: null, or a feature holding none.
Unset func(v runtime.Value) bool
}
Spelling renders a run's values for the text it cannot supply itself.
type Subject ¶
type Subject struct {
// Usage is the subject object's qualified name, or "" when it has none.
Usage string
// Text is the subject as subjectName reports it.
Text string
}
Subject is how a run's object is recorded: its usage in the model, and its text for subjectName.
func SubjectOf ¶ added in v0.11.0
func SubjectOf(idx *symbols.Index, inst *runtime.Instance, label string, contexts map[*runtime.Context]bool, text func(*runtime.Context, runtime.Value) string) Subject
SubjectOf names the object a run was made on: its usage when one usage alone declares it, else its text in the context it lives in, else label.