record

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 7 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 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

This section is empty.

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 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.

func Generate

func Generate(req Request) (Result, error)

Generate renders the declarations recording req's runs.

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.

Jump to

Keyboard shortcuts

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