grpc

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 63 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

Index

Constants

View Source
const (
	QueryPropID                   = corequery.PropertyID
	QueryPropType                 = corequery.PropertyType
	QueryPropName                 = corequery.PropertyName
	QueryPropDeclaredName         = corequery.PropertyDeclaredName
	QueryPropShortName            = corequery.PropertyShortName
	QueryPropDeclaredShortName    = corequery.PropertyDeclaredShortName
	QueryPropDocumentation        = corequery.PropertyDocumentation
	QueryPropQualifiedName        = corequery.PropertyQualifiedName
	QueryPropOwner                = corequery.PropertyOwner
	QueryPropIsAbstract           = corequery.PropertyIsAbstract
	QueryPropElementType          = corequery.PropertyElementType
	QueryPropMultiplicityLower    = corequery.PropertyMultiplicityLower
	QueryPropMultiplicityUpper    = corequery.PropertyMultiplicityUpper
	QueryPropSatisfiedRequirement = corequery.PropertySatisfiedRequirement
	QueryPropSatisfyingFeature    = corequery.PropertySatisfyingFeature
)

Query property names, as the SysML v2 API & Services standard's clients write them. docs/reference/api.md documents what each one reports.

View Source
const (
	TriggerCompletion = "completion"
	TriggerSignal     = "signal"
	TriggerTime       = "time"
	TriggerChange     = "change"
	TriggerCall       = "call"
)

Trigger kinds a SessionTransition reports.

View Source
const CapabilityActionBodyStatementAuthoring = "action_body_statement_authoring"

CapabilityActionBodyStatementAuthoring names the extended action-body items and source-end multiplicities carried by add_sequence.

View Source
const CapabilityActionTrace = "action_trace"

CapabilityActionTrace names the ExecuteAction trace request field.

View Source
const CapabilityApplyEdits = "apply_edits"

CapabilityApplyEdits names the capability of the ApplyEdits RPC, which edits a parsed model's own source, preserving everything the edit did not touch.

View Source
const CapabilityAuthoring = "authoring"

CapabilityAuthoring gates source-authoring ApplyEdits operations; dedicated capabilities further gate specialized authoring operations.

View Source
const CapabilityBigIntValues = "big_int_values"

CapabilityBigIntValues names the capability of carrying an Integer beyond int64 as Value.big_int_value, Quantity.big_int_magnitude and DocumentValue.big_int_value, rather than as an unsupported null. A service without it reads the arm sent to it as null, so a client must not send one.

View Source
const CapabilityCaseEvaluations = "case_evaluations"

CapabilityCaseEvaluations names the capability of reporting each application an analysis run made of one of the case's calcs as a function value — a trade study's evaluation of each alternative — and of keeping what a failed run computed beside its error.

View Source
const CapabilityCheck = "check"

CapabilityCheck names the CheckBehavior RPC, which searches every schedule of a behavior for violated properties, deadlocks, failures and divergent values.

View Source
const CapabilityCommentAuthoring = "comment_authoring"

CapabilityCommentAuthoring names the ApplyEdits add_comment and add_note operations.

View Source
const CapabilityCompareResults = "compare_results"

CapabilityCompareResults names the CompareResults RPC, which runs the configurations a tool's results sidecar indexes and tables the tool's distributions of their observables beside the runs'.

View Source
const CapabilityComplexValues = "complex_values"

CapabilityComplexValues names the capability of carrying a complex number as Value.complex, rather than reporting it as an unsupported null.

View Source
const CapabilityConnectionAuthoring = "connection_authoring"

CapabilityConnectionAuthoring names the ApplyEdits add_connection operation.

View Source
const CapabilityConstraintBodyAuthoring = "constraint_body_authoring"

CapabilityConstraintBodyAuthoring names constraint body expressions and asserted constraints.

View Source
const CapabilityConvert = "convert"

CapabilityConvert names the capability of the Convert RPC, which writes a model back out as SysML notation or RDF Turtle. The RDF direction is experimental, which the response says per conversion.

View Source
const CapabilityConvertCheckDiagnostics = "convert_check_diagnostics"

CapabilityConvertCheckDiagnostics names ConvertRequest.include_check_diagnostics: the semantic check's diagnostics, with their severities, reported alongside the converted output.

View Source
const CapabilityConvertCompact = "convert_compact"

CapabilityConvertCompact names ConvertRequest.compact, omit_derived and keep_derived: api-json written as the compact document, with an id table and handles, and optionally without the metamodel's derived properties.

View Source
const CapabilityConvertDocuments = "convert_documents"

CapabilityConvertDocuments names ConvertRequest.documents, which writes only the named documents of a model and links the rest by id.

View Source
const CapabilityConvertLibraryReferences = "convert_library_references"

CapabilityConvertLibraryReferences names ConvertResponse.library_references.

View Source
const CapabilityConvertLibraryStubs = "convert_library_stubs"

CapabilityConvertLibraryStubs names ConvertRequest.include_library_stubs.

View Source
const CapabilityDiagnosticCodes = "diagnostic_codes"

CapabilityDiagnosticCodes names the capability of populating Diagnostic.code, so an empty code is a finding none was assigned rather than an older service.

View Source
const CapabilityDocumentQuery = "document_query"

CapabilityDocumentQuery names the capability of the RunDocumentQuery RPC, which runs a named document query and answers with typed rows.

View Source
const CapabilityDocumentationAuthoring = "documentation_authoring"

CapabilityDocumentationAuthoring names the ApplyEdits add_documentation operation and the AddMember doc field.

View Source
const CapabilityEditDocuments = "edit_documents"

CapabilityEditDocuments names the capability of editing a model of several documents as one batch, for a request accepting documents, and of answering each edited document by name in ApplyEditsResponse.documents.

View Source
const CapabilityEngines = "engines"

CapabilityEngines names the ListEngines RPC, the `engine` field of the verification and sweep requests, and the `engine`, `strength` and `bounds` fields of their responses and of every Verdict.

View Source
const CapabilityEnginesExternal = "engines_external"

CapabilityEnginesExternal says the service was started with -serve-external-engines and runs the manifest engines it names; ListEngines reports which with `served`.

View Source
const CapabilityEnumValues = "enum_values"

CapabilityEnumValues names the capability of carrying an enumeration literal as Value.enum_literal, rather than reporting it as an unsupported null.

View Source
const CapabilityEvaluateSubject = "evaluate_subject"

CapabilityEvaluateSubject names the capability of evaluating an expression against an instantiated subject.

View Source
const CapabilityExportGraphs = "export_graphs"

CapabilityExportGraphs names the capability of the ExportGraphs RPC, which exports the lowered graph of an action or state machine as `graphs:1` JSON.

View Source
const CapabilityFeatureValues = "feature_values"

CapabilityFeatureValues names the capability of populating Instance.feature_values, which replaced the pre-0.1.0 Instance.slots.

View Source
const CapabilityFinalTime = "final_time"

CapabilityFinalTime names the capability of populating final_time on ExecuteActionResponse and ExecuteStateResponse, the run's simulation clock when it ended. Without it the field is 0 whatever the run waited on.

View Source
const CapabilityFunctionValues = "function_values"

CapabilityFunctionValues names the capability of carrying a calc held as a value as Value.function, named by its declaration, rather than reporting it as an unsupported null.

View Source
const CapabilityImplicitParameters = "implicit_parameters"

CapabilityImplicitParameters names the ApplyEdits add_member operation with no kind: an implicit directed usage (`in x : T;`).

View Source
const CapabilityImportAuthoring = "import_authoring"

CapabilityImportAuthoring names the ApplyEdits add_import operation.

View Source
const CapabilityImportData = "import_data"

CapabilityImportData names the ImportData RPC, which sets the feature values a CSV, TSV, JSON or JSON Lines file assigns, one row per element.

View Source
const CapabilityInfinityValue = "infinity_value"

CapabilityInfinityValue names the capability of carrying the unbounded value `*` as Value.infinity, rather than reporting it as an unsupported null.

View Source
const CapabilityInlineLanguage = "inline_language"

CapabilityInlineLanguage names explicit language selection for inline content.

View Source
const CapabilityMeasurementRefs = "measurement_refs"

CapabilityMeasurementRefs names the capability of carrying a bare measurement reference as Value.measurement_ref, rather than reporting it as an unsupported null. Distinct from structured_values, which predates the arm.

View Source
const CapabilityMemberModifiers = "member_modifiers"

CapabilityMemberModifiers names the additional AddMember modifiers and kinds.

View Source
const CapabilityMetadataAuthoring = "metadata_authoring"

CapabilityMetadataAuthoring names metadata usages and metadata prefixes.

View Source
const CapabilityMetadataPrefixAuthoring = "metadata_prefix_authoring"

CapabilityMetadataPrefixAuthoring names edits that add metadata to an existing declaration.

View Source
const CapabilityMetaobjectValues = "metaobject_values"

CapabilityMetaobjectValues names the capability of carrying an element reflected on as an instance of its metaclass (`x meta T`, the last element of `x.metadata`) as Value.metaobject, rather than as an unsupported null.

View Source
const CapabilityMigrate = "migrate"

CapabilityMigrate names the capability of the Migrate RPC, which migrates a SysML v1 model to v2 and accounts for every element — mapped, approximated, unmapped or skipped — in its report. Migration is experimental, which the response says.

View Source
const CapabilityOSLCQuery = "oslc_query"

CapabilityOSLCQuery names the capability of evaluating OSLC Query text.

View Source
const CapabilityOrderDependence = "order_dependence"

CapabilityOrderDependence names the capability of reporting what a run's values stand only up to: `order_dependent` on FeatureValue, ExecuteActionResponse and ExecuteStateResponse, and `order_dependent` and `independent` on a choice-point Diagnostic. Without it the fields are empty and a value prints as fixed whatever order the run took.

View Source
const CapabilityParseSources = "parse_sources"

CapabilityParseSources names the ParseSources RPC, which parses several documents as one model so a name one declares resolves in another.

View Source
const CapabilityParseSourcesAffected = "parse_sources_affected"

CapabilityParseSourcesAffected names ParseSourcesRequest.base_model_hash and ParseSourcesResponse.affected: the documents whose results may differ from the base model's, so a client re-reads only those after an edit.

View Source
const CapabilityPerformer = "performer"

CapabilityPerformer names the `performer_symbol_id` field of ExecuteActionRequest and ExecuteStateRequest; a service without it runs outside any object, so clients must not send it.

View Source
const CapabilityQuery = "query"

CapabilityQuery names the capability of the Query RPC, which evaluates a SysML v2 API & Services Query over a parsed model.

View Source
const CapabilityQueryOrderBy = "query_order_by"

CapabilityQueryOrderBy names the capability of Query's order_by field, which sorts the matched elements; a service without it would ignore the field.

View Source
const CapabilityRationalValues = "rational_values"

CapabilityRationalValues names the capability of carrying an exact Rational that is no Integer as Value.rational_value, Quantity.rational_magnitude and DocumentValue.rational_value, rather than as an unsupported null. A service without it reads the arm sent to it as null, so a client must not send one.

View Source
const CapabilityRecordRun = "record_run"

CapabilityRecordRun names the RecordRun RPC, which records runs of an analysis case into the model as AnalysisRecords declarations.

View Source
const CapabilityRenderDocument = "render_document"

CapabilityRenderDocument names the capability of the RenderDocument RPC, which renders a named document to Markdown.

View Source
const CapabilityRenderDocumentAsciiDoc = "render_document_asciidoc"

CapabilityRenderDocumentAsciiDoc names the capability of RenderDocumentRequest's form field taking "asciidoc", answered in RenderDocumentResponse.asciidoc.

View Source
const CapabilityRenderDocumentFileName = "render_document_file_name"

CapabilityRenderDocumentFileName names RenderDocumentResponse.file_name: the file a rendered set writes the document to, which the other documents' links to it name. Without it the field is empty.

View Source
const CapabilityRenderDocumentHTML = "render_document_html"

CapabilityRenderDocumentHTML names the capability of RenderDocumentRequest's form field, which asks RenderDocument for HTML instead of Markdown.

View Source
const CapabilityRenderView = "render_view"

CapabilityRenderView names the capability of the RenderView RPC, which renders a declared or targeted pseudo-view as machine-readable diagram data.

View Source
const CapabilityRequirementConstraintAuthoring = "requirement_constraint_authoring"

CapabilityRequirementConstraintAuthoring names the ApplyEdits add_requirement_constraint operation.

View Source
const CapabilityRuns = "runs"

CapabilityRuns names the RunRuns RPC, which runs an action or a Monte Carlo case repeatedly and tables what the runs observed.

View Source
const CapabilitySatisfyAuthoring = "satisfy_authoring"

CapabilitySatisfyAuthoring names the ApplyEdits add_satisfy operation.

View Source
const CapabilitySchedule = "schedule"

CapabilitySchedule names the `schedule` field of ExecuteActionRequest, ExecuteStateRequest and RunAnalysisRequest, which selects the scheduling policy a run resolves its choice points under. A service without it runs every request under the default, so a client must not send the field to one.

View Source
const CapabilityScheduleExplore = "schedule_explore"

CapabilityScheduleExplore names the capability of answering a request under `explore[:runs=<n>,depth=<d>]` with `outcomes` and an `exploration` status.

View Source
const CapabilitySelfCheck = "self_check"

CapabilitySelfCheck names the SelfCheck RPC, which applies the reflective SysMLValidation constraints to every element of a model.

View Source
const CapabilitySequenceAuthoring = "sequence_authoring"

CapabilitySequenceAuthoring names the ApplyEdits add_sequence operation.

View Source
const CapabilitySetValues = "set_values"

CapabilitySetValues names the capability of carrying a unique, unordered collection as Value.set, rather than reporting it as an unsupported null.

View Source
const CapabilityStateActionAuthoring = "state_action_authoring"

CapabilityStateActionAuthoring names state behavior member kinds.

View Source
const CapabilityStateTrace = "state_trace"

CapabilityStateTrace names the ExecuteState trace request field.

View Source
const CapabilityStrictConformance = "strict_conformance"

CapabilityStrictConformance names ParseFileRequest.strict_conformance, which asks whether the source is conforming SysML v2.

View Source
const CapabilityStructuredValues = "structured_values"

CapabilityStructuredValues names the capability of carrying an array, a vector and a vector quantity as Value.array, Value.vector and Value.vector_quantity, rather than reporting them as unsupported nulls.

View Source
const CapabilitySymbolAttributes = "symbol_attributes"

CapabilitySymbolAttributes names the capability of populating SymbolInfo.attributes, rather than always reporting none.

View Source
const CapabilityTensorValues = "tensor_values"

CapabilityTensorValues names the capability of carrying a tensor quantity of any rank as Value.tensor_quantity, rather than as an unsupported null.

View Source
const CapabilityTransitionAuthoring = "transition_authoring"

CapabilityTransitionAuthoring names the ApplyEdits add_transition operation.

View Source
const CapabilityTypeFacts = "type_facts"

CapabilityTypeFacts names the capability of populating SymbolInfo.type_info, .multiplicity and .specializations, which typed code generation requires.

View Source
const CapabilityUndeterminedValue = "undetermined_value"

CapabilityUndeterminedValue names the capability of carrying a result the model leaves open as Value.undetermined rather than as an unsupported null.

View Source
const CapabilityUnsetValue = "unset_value"

CapabilityUnsetValue names the capability of reporting a valueless feature of a value type as Value.unset, rather than as the empty object it materializes.

View Source
const CapabilityVerdictNotes = "verdict_notes"

CapabilityVerdictNotes names the `notes` field of every Verdict: the assumptions and omissions behind a solver's answer, as the REPL prints them.

View Source
const CapabilityVerification = "verification"

CapabilityVerification names the capability of the verification RPCs, which answer the questions the REPL's %constraint, %requirement, %satisfy and %calc answer.

View Source
const CapabilityVerificationArguments = "verification_arguments"

CapabilityVerificationArguments names the `arguments` and `named_arguments` fields of VerifyConstraintRequest and VerifyRequirementRequest, which bind the checked element's `in` parameters as RunAnalysisRequest binds a case's.

View Source
const CapabilityVerificationObjectiveAuthoring = "verification_objective_authoring"

CapabilityVerificationObjectiveAuthoring names verification-case objective authoring.

View Source
const CapabilityVerificationQuestions = "verification_questions"

CapabilityVerificationQuestions names the `question` field of the verification requests — the solver questions "holds" and "satisfiable" — and the `question`, `status` and `witness` fields of every Verdict.

View Source
const CapabilityVerificationVerdicts = "verification_verdicts"

CapabilityVerificationVerdicts names the capability of reporting what the body of a verification case answered as VerificationVerdict, and of running a verification case through RunAnalysis.

View Source
const DefaultIndexPrewarm = 4

DefaultIndexPrewarm is the value IndexPrewarmEnvVar takes when unset: any positive value prewarms, since one library index now serves every model.

View Source
const DefaultMaxHeldEvents = 100000

DefaultMaxHeldEvents is the bound HeldEventsEnvVar takes when unset.

View Source
const DefaultMaxHeldObjects = 10000

DefaultMaxHeldObjects is the bound HeldObjectsEnvVar takes when unset.

View Source
const HeldEventsEnvVar = "OPENSYSML_GRPC_MAX_HELD_EVENTS"

HeldEventsEnvVar names the variable bounding the event records a cached population keeps for Events; the oldest are dropped and a query reaching them fails.

View Source
const HeldObjectsEnvVar = "OPENSYSML_GRPC_MAX_HELD_OBJECTS"

HeldObjectsEnvVar names the variable bounding the objects one cached model holds, nested objects counted: a materialization that would pass it fails whole, and the model leaving the cache releases them all.

View Source
const IndexPrewarmEnvVar = "OPENSYSML_GRPC_INDEX_POOL"

IndexPrewarmEnvVar names the variable saying whether the service builds the standard library index before the requests that need it. Zero disables prewarming, so the first request builds it. The legacy SYSML_GRPC_INDEX_POOL name remains accepted; the OPENSYSML_ name wins when both are set.

View Source
const SyntaxDiagnosticCode = parser.CodeSyntax

SyntaxDiagnosticCode is the code a parser error is reported under when the parser gave it none of its own.

View Source
const TestWithholdCapabilitiesEnv = "OPENSYSML_TEST_WITHHOLD_CAPABILITIES"

TestWithholdCapabilitiesEnv names, comma-separated, the capabilities a command's service deliberately lacks, so a conformance run can test a client's fallback for each.

Variables

This section is empty.

Functions

func Capabilities

func Capabilities() []string

Capabilities returns the capability names this build of the service reports.

func DiagnosticToProto

func DiagnosticToProto(diag diag.Diagnostic, sf *source.SourceFile) *pb.Diagnostic

DiagnosticToProto converts a diag.Diagnostic to protobuf.

func NewSymbolContext

func NewSymbolContext(idx *symbols.Index) *symbolfacts.Context

NewSymbolContext builds the symbolfacts conversion context for cached-model symbols.

func ParserDiagnosticToProto

func ParserDiagnosticToProto(diag parser.Diagnostic, sf *source.SourceFile) *pb.Diagnostic

ParserDiagnosticToProto converts a parser error to protobuf.

func QueryPropertyNames

func QueryPropertyNames() []string

QueryPropertyNames returns every queryable property name, sorted. It is what an unknown-property error lists, and what docs/reference/api.md's table documents.

func RunNoteDiagnosticsToProto

func RunNoteDiagnosticsToProto(notes []runtime.RunNote, model *CachedModel) []*pb.Diagnostic

RunNoteDiagnosticsToProto converts what a run noted about itself — its choice points and the guards it could not evaluate — to informational diagnostics, located in their model document; one outside the model carries no span.

func SymbolToProtoIn

func SymbolToProtoIn(sym *symbols.Symbol, sc *symbolfacts.Context) *pb.SymbolInfo

SymbolToProtoIn converts a Symbol to protobuf SymbolInfo in an existing conversion context.

func WithheldCapabilitiesForTesting added in v0.11.0

func WithheldCapabilitiesForTesting() []string

WithheldCapabilitiesForTesting reads TestWithholdCapabilitiesEnv, dropping blanks; nil when it is unset.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is an LRU cache for parsed models keyed by content hash

func NewCache

func NewCache(maxSize int) (*Cache, error)

NewCache creates a cache with the specified max size. It returns an error if maxSize is not positive.

func (*Cache) Add

func (c *Cache) Add(hash string, model *CachedModel) *CachedModel

Add caches model under hash unless the hash is already cached, and returns the model cached under it: two parses of one model racing to the cache end up sharing the one entry, and the objects held on it, rather than replacing it.

func (*Cache) Get

func (c *Cache) Get(hash string) (*CachedModel, bool)

Get retrieves a model from cache, returns (model, true) on hit

func (*Cache) Put

func (c *Cache) Put(hash string, model *CachedModel)

Put adds a model to cache, evicting LRU if at capacity

type CachedDocument

type CachedDocument struct {
	Root   *ast.RootNamespace
	Source *source.SourceFile // For diagnostic line/col mapping
	// ParseDiags are the parse's errors, for the consumers that refuse a
	// document that did not parse.
	ParseDiags []parser.Diagnostic
	// Diagnostics are what the document reports, as the workspace reports a
	// document's: the parse's errors and warnings as the passes present them,
	// and the passes' own findings when the model parsed clean and was analyzed.
	Diagnostics []diag.Diagnostic
	// Unfiltered is Diagnostics before the default lint selection was applied,
	// every lint finding kept, so a request selecting lints of its own is
	// answered from it; nil when the document was not analyzed.
	Unfiltered []diag.Diagnostic
	Warnings   []string
	// contains filtered or unexported fields
}

CachedDocument is one parsed document of a model.

type CachedModel

type CachedModel struct {
	// Documents are the model's documents, at least one, in the order the parse
	// request named them. They share Index, so a name one declares resolves in
	// another and an import between them is satisfied.
	Documents []*CachedDocument
	Index     *symbols.Index // For symbol lookups by FQN
	Library   libs.Source    // the files the library in Index was built from, for their spans' text
	// Mode is the conformance strictness the parse request asked for; an edit's
	// notation is judged at the same strictness.
	Mode diag.ConformanceMode
	// Findings are what is wrong with the model's documents taken together, a
	// library package two of them declare; each names the document it is on,
	// which may be a library document rather than one of Documents.
	Findings []checkws.Finding
	// contains filtered or unexported fields
}

CachedModel holds parsed model data with semantic analysis results

func (*CachedModel) DocumentRoots

func (m *CachedModel) DocumentRoots() []*symbols.Scope

DocumentRoots are the root scopes of the model's documents, in order, skipping any the index does not hold.

func (*CachedModel) LookupNamedMember added in v0.10.1

func (m *CachedModel) LookupNamedMember(id string) []*symbols.Symbol

LookupNamedMember resolves a symbol id, a member a subtype inherits included (Sub::inherited), under the symbol context's lock: the member walk memoizes into the shared semantic model.

func (*CachedModel) Primary

func (m *CachedModel) Primary() *CachedDocument

Primary is the document a model is named by: the only one of a single-document model, and the first named of a multi-document one, whose root namespace is where a name with nothing else to resolve against is looked up.

func (*CachedModel) PrimaryRoot

func (m *CachedModel) PrimaryRoot() *symbols.Scope

PrimaryRoot is the root scope of the document the model is named by.

func (*CachedModel) Semantics

func (m *CachedModel) Semantics() (*runtime.Model, error)

Semantics is the model-derived runtime part as an analysis.Model builds one.

func (*CachedModel) SoleDocument

func (m *CachedModel) SoleDocument() (*CachedDocument, error)

SoleDocument is the model's one document, for an operation defined on a single document's own source, such as writing it back out. A model of several documents is refused rather than answered about one of them.

func (*CachedModel) SymbolContext

func (m *CachedModel) SymbolContext() *symbolfacts.Context

SymbolContext returns the conversion context for this model, building it on first use. Name resolution and the semantic relations derived from it are memoized in it, so every symbol converted from one cached model shares one.

type ConnectAdapter

type ConnectAdapter struct {
	// contains filtered or unexported fields
}

ConnectAdapter serves the same Service through the Connect handler signatures, so one implementation answers every protocol Connect speaks.

func NewConnectAdapter

func NewConnectAdapter(svc *Service) *ConnectAdapter

NewConnectAdapter wraps a Service as a Connect handler.

func (*ConnectAdapter) ApplyEdits

ApplyEdits edits a parsed model's own source.

func (*ConnectAdapter) CheckBehavior added in v0.11.0

func (*ConnectAdapter) CompareResults added in v0.11.0

CompareResults runs the configurations a results sidecar indexes and compares the runs with the tool's.

func (*ConnectAdapter) Convert

Convert writes a model out as SysML notation or RDF Turtle.

func (*ConnectAdapter) Evaluate

Evaluate evaluates an expression against a parsed model.

func (*ConnectAdapter) EvaluateCalc

EvaluateCalc evaluates a calculation with the arguments given.

func (*ConnectAdapter) ExecuteAction

ExecuteAction runs an action to completion.

func (*ConnectAdapter) ExecuteState

ExecuteState runs a state machine over the events given.

func (*ConnectAdapter) ExportGraphs added in v0.10.0

ExportGraphs exports the lowered graph of an action or state machine as graphs:1 JSON.

func (*ConnectAdapter) GetDiagnostics

GetDiagnostics returns the diagnostics of a parsed model.

func (*ConnectAdapter) GetServerInfo

GetServerInfo reports what this build of the service can do.

func (*ConnectAdapter) GetSymbol

GetSymbol returns symbol information by qualified name.

func (*ConnectAdapter) ImportData added in v0.11.0

ImportData sets the feature values data files assign, as `sysml -import` does.

func (*ConnectAdapter) Instantiate

Instantiate materializes an instance of a definition.

func (*ConnectAdapter) ListEngines

ListEngines lists the analysis engines this build registers.

func (*ConnectAdapter) Migrate added in v0.10.0

Migrate writes a SysML v1 model out as a v2 one, with the report of what became of every v1 element.

func (*ConnectAdapter) ParseFile

ParseFile parses a model and returns its hash.

func (*ConnectAdapter) ParseSources

ParseSources parses several documents as one model.

func (*ConnectAdapter) Query

Query evaluates a SysML v2 API & Services Query over a parsed model.

func (*ConnectAdapter) RecordRun added in v0.11.0

RecordRun runs an analysis case and records the runs into the model.

func (*ConnectAdapter) RenderDocument

RenderDocument renders a named document to Markdown.

func (*ConnectAdapter) RenderView added in v0.10.0

RenderView renders a named view or targeted pseudo-view as diagram data.

func (*ConnectAdapter) RunAnalysis

RunAnalysis runs an analysis case with the subject and arguments given.

func (*ConnectAdapter) RunDocumentQuery

RunDocumentQuery runs a named document query and answers with typed rows.

func (*ConnectAdapter) RunRuns added in v0.11.0

RunRuns runs an action or a Monte Carlo case repeatedly and tables the runs.

func (*ConnectAdapter) RunSweep

RunSweep runs one analysis case or calc once per row of a parameter sweep.

func (*ConnectAdapter) SelfCheck added in v0.11.0

SelfCheck applies the reflective SysMLValidation constraints to every element of a model.

func (*ConnectAdapter) ValidateInstance

ValidateInstance checks every assertion about an object and the objects it holds.

func (*ConnectAdapter) VerifyConstraint

VerifyConstraint evaluates a constraint and returns its verdict.

func (*ConnectAdapter) VerifyRequirement

VerifyRequirement evaluates a requirement and returns its verdict.

func (*ConnectAdapter) VerifySatisfaction

VerifySatisfaction evaluates satisfaction relationships in a model.

type Option

type Option func(*serviceOptions)

Option adjusts how NewService builds a service.

func ServeExternalEngines

func ServeExternalEngines(names ...string) Option

ServeExternalEngines names the manifest engines the service runs, as -serve-external-engines does; `all` names every one. Without it every manifest engine is listed but not served.

type QueryError

type QueryError struct {
	Kind    QueryErrorKind
	Message string
}

QueryError is a query the service refuses to evaluate. It reports itself as INVALID_ARGUMENT, since every kind is a fault in the query, not in the model.

func (*QueryError) Error

func (e *QueryError) Error() string

type QueryErrorKind

type QueryErrorKind int

QueryErrorKind classifies why a query could not be evaluated. Every kind fails the call: answering with no elements would read as "nothing matched".

const (
	// QueryErrUnknownProperty is a property no queryable property names.
	QueryErrUnknownProperty QueryErrorKind = iota + 1
	// QueryErrMalformedConstraint is a constraint with no form, no operator or
	// no operand.
	QueryErrMalformedConstraint
	// QueryErrUnorderedProperty is an ordered comparison (<, <=, >, >=) on a
	// property that is not ordered, or instanceOf on one that is not "@type".
	QueryErrUnorderedProperty
	// QueryErrUnparsableValue is an operand the operator cannot compare: a
	// non-number for an ordered comparison, an undeclared metaclass for instanceOf.
	QueryErrUnparsableValue
	// QueryErrUnknownScope is a scope naming an element the model does not have.
	QueryErrUnknownScope
)

type Service

type Service struct {
	pb.UnimplementedSysMLServiceServer
	// contains filtered or unexported fields
}

Service implements SysMLServiceServer

func NewService

func NewService(cacheSize int, version string, opts ...Option) (*Service, error)

NewService creates a gRPC service with specified cache size, reporting version as its build version. It returns an error if cacheSize is not positive, if a budget variable, OPENSYSML_JOBS, OPENSYSML_GRPC_MAX_HELD_OBJECTS or OPENSYSML_GRPC_MAX_HELD_EVENTS holds anything but a positive integer, if the prewarm setting is not a non-negative integer, or if a manifest or a name given to ServeExternalEngines is wrong. It does not load the standard library: call Prewarm to have that happen in the background, ahead of the requests that need it.

func NewServiceWithUnavailableCapabilitiesForTesting

func NewServiceWithUnavailableCapabilitiesForTesting(cacheSize int, version string, unavailable []string, opts ...Option) (*Service, error)

NewServiceWithUnavailableCapabilitiesForTesting creates a service that deliberately lacks named capabilities for conformance testing.

func (*Service) ApplyEdits

func (s *Service) ApplyEdits(ctx context.Context, req *pb.ApplyEditsRequest) (*pb.ApplyEditsResponse, error)

ApplyEdits edits the source a model was parsed from and returns the edited notation, so a client can change a model and write it back with its comments and layout intact. A model of several documents is edited as one, for a request that accepts documents: the operations target the document the request names, a rename or cascade delete follows references into every other, and the response carries each document the edits rewrote, or none when they were refused. A request not accepting documents is refused on such a model, since it reads only content. Argument faults fail the call; an edit the engine refuses is reported in the response's error, failure kind and diagnostics. Without the edit_documents capability the service answers as one predating documents: a model of several is refused, a named document is refused with UNIMPLEMENTED, and the response carries content alone.

func (*Service) CheckBehavior added in v0.11.0

func (s *Service) CheckBehavior(ctx context.Context, req *pb.CheckBehaviorRequest) (*pb.CheckBehaviorResponse, error)

CheckBehavior searches every schedule of an action or a state machine, as the `sysml` command's -check-* flags do about -action/-state: a violated property, a deadlock, a failure or a divergent feature is witnessed, replayed and reported.

func (*Service) Close

func (s *Service) Close()

Close waits for a background library build in flight and releases the service's reference to the shared index. The service still answers afterwards, building the library on the request that needs it.

func (*Service) CompareResults added in v0.11.0

func (s *Service) CompareResults(ctx context.Context, req *pb.CompareResultsRequest) (*pb.CompareResultsResponse, error)

CompareResults runs each configuration the sidecar indexes as its tool ran it and tables the tool's distribution of every observable beside the runs'.

func (*Service) Convert

func (s *Service) Convert(ctx context.Context, req *pb.ConvertRequest) (*pb.ConvertResponse, error)

Convert writes a model in another representation, so a client can save a model it read rather than only inspect it. Argument faults fail the call; a model the converter refuses is reported in the response's error and diagnostics.

func (*Service) Evaluate

func (s *Service) Evaluate(ctx context.Context, req *pb.EvaluateRequest) (*pb.EvaluateResponse, error)

Evaluate evaluates a SysML expression in the context of a parsed model

func (*Service) EvaluateCalc

func (s *Service) EvaluateCalc(ctx context.Context, req *pb.EvaluateCalcRequest) (*pb.EvaluateCalcResponse, error)

EvaluateCalc invokes a calculation, as the REPL's %calc does: a calc usage named with no arguments is evaluated from its own members and reports every output feature it computes (SysML 7.17); anything else is invoked with the arguments given, bound positionally.

func (*Service) ExecuteAction

func (s *Service) ExecuteAction(ctx context.Context, req *pb.ExecuteActionRequest) (*pb.ExecuteActionResponse, error)

ExecuteAction executes an action definition

func (*Service) ExecuteState

func (s *Service) ExecuteState(ctx context.Context, req *pb.ExecuteStateRequest) (*pb.ExecuteStateResponse, error)

ExecuteState executes a state machine

func (*Service) ExportGraphs added in v0.10.0

func (s *Service) ExportGraphs(ctx context.Context, req *pb.ExportGraphsRequest) (*pb.ExportGraphsResponse, error)

ExportGraphs exports the lowered graph of an action or state machine, and of every behavior it performs, as the canonical `graphs:1` JSON an external engine is sent. An unknown subject is NOT_FOUND; one that is no behavior, or a name several elements share, is INVALID_ARGUMENT.

func (*Service) GetDiagnostics

func (s *Service) GetDiagnostics(ctx context.Context, req *pb.DiagnosticsRequest) (*pb.DiagnosticsResponse, error)

GetDiagnostics retrieves all diagnostics for a parsed model (parser + semantic passes)

func (*Service) GetServerInfo

func (s *Service) GetServerInfo(ctx context.Context, req *pb.ServerInfoRequest) (*pb.ServerInfoResponse, error)

GetServerInfo reports the service's build version and capabilities. A service too old to have this RPC fails the call with UNIMPLEMENTED, which is itself the answer that it predates every capability.

func (*Service) GetSymbol

func (s *Service) GetSymbol(ctx context.Context, req *pb.GetSymbolRequest) (*pb.SymbolResponse, error)

GetSymbol retrieves symbol information by FQN

func (*Service) ImportData added in v0.11.0

func (s *Service) ImportData(ctx context.Context, req *pb.ImportDataRequest) (*pb.ImportDataResponse, error)

ImportData sets the feature values each data file assigns, as one edit of the model per file, as `sysml -import` does: a feature the element declares has its value set, one it inherits is redefined in the element's body with the value. A file the model refuses leaves the model as it was.

func (*Service) Instantiate

func (s *Service) Instantiate(ctx context.Context, req *pb.InstantiateRequest) (*pb.InstantiateResponse, error)

Instantiate creates a runtime instance of a part/usage

func (*Service) ListEngines

ListEngines lists the engines this build registers, in name order.

func (*Service) Migrate added in v0.10.0

func (s *Service) Migrate(ctx context.Context, req *pb.MigrateRequest) (*pb.MigrateResponse, error)

Migrate writes a SysML v1 model as a v2 one, with the account of what became of every v1 element that makes the migration a migration rather than a conversion. Argument faults fail the call; a model the migrator refuses is reported in the response's error, as Convert reports one.

func (*Service) OpenSession

func (s *Service) OpenSession(modelHash string) (*Session, error)

OpenSession opens a session over a cached model, holding one of the model's workers until the session is closed.

func (*Service) ParseFile

func (s *Service) ParseFile(ctx context.Context, req *pb.ParseFileRequest) (*pb.ParseFileResponse, error)

ParseFile parses a SysML file and caches the result

func (*Service) ParseSources

func (s *Service) ParseSources(ctx context.Context, req *pb.ParseSourcesRequest) (*pb.ParseSourcesResponse, error)

ParseSources parses several documents as one model, so a name one document declares resolves in another.

func (*Service) Prewarm

func (s *Service) Prewarm()

Prewarm starts building the service's standard library index in the background, so the first model to arrive is not the one that pays for the library. It returns immediately and is safe to call more than once.

func (*Service) Query

func (s *Service) Query(ctx context.Context, req *pb.QueryRequest) (*pb.QueryResponse, error)

Query evaluates a SysML v2 API & Services Query against a parsed model.

func (*Service) RecordRun added in v0.11.0

func (s *Service) RecordRun(ctx context.Context, req *pb.RecordRunRequest) (*pb.RecordRunResponse, error)

RecordRun runs an analysis case once, over a sweep's rows or as a Monte Carlo sample, and records the runs into the model as AnalysisRecords declarations, the way `sysml -record-run` does.

func (*Service) RenderDocument

func (s *Service) RenderDocument(ctx context.Context, req *pb.RenderDocumentRequest) (*pb.RenderDocumentResponse, error)

RenderDocument renders a named document to Markdown, HTML or AsciiDoc, as -render-document does.

func (*Service) RenderView added in v0.10.0

func (s *Service) RenderView(ctx context.Context, req *pb.RenderViewRequest) (*pb.RenderViewResponse, error)

RenderView renders a declared view or targeted pseudo-view as diagram data.

func (*Service) RunAnalysis

func (s *Service) RunAnalysis(ctx context.Context, req *pb.RunAnalysisRequest) (*pb.RunAnalysisResponse, error)

RunAnalysis runs an analysis case, as the REPL's %analysis does: the subject named is instantiated and bound, the arguments bind the case's inputs, and the response carries every output with the verdict of each objective and assertion (SysML 7.22).

func (*Service) RunDocumentQuery

RunDocumentQuery runs a named document query with parameter bindings, the answer %run-query gives, as typed rows rather than formatted lines.

func (*Service) RunRuns added in v0.11.0

func (s *Service) RunRuns(ctx context.Context, req *pb.RunRunsRequest) (*pb.RunRunsResponse, error)

RunRuns runs an action, or a Simulation::MonteCarlo analysis case, the requested number of times, as the CLI's -runs/-observe and the REPL's %runs do: every run is an ordinary run in a context of its own, drawing its modeled randomness from a seed derived from the request's, and the table reports what each run observed with each observable's distribution. A run that failed is that row's error; only a request no run follows from fails the table.

func (*Service) RunSweep

func (s *Service) RunSweep(ctx context.Context, req *pb.RunSweepRequest) (*pb.RunSweepResponse, error)

RunSweep runs one analysis case or calc once per row of a parameter sweep, as the CLI's -sweep and the REPL's %sweep do: every row is an ordinary run, in a context of its own, with the swept parameters bound to that row's values. A run that failed is that row's error; only a plan that no run follows from fails the table. The request's subject and arguments are read once on the request's runtime, which answers one that cannot be read, and again in every row's, which is what the row's run binds.

func (*Service) SelfCheck added in v0.11.0

func (s *Service) SelfCheck(ctx context.Context, req *pb.SelfCheckRequest) (*pb.SelfCheckResponse, error)

SelfCheck applies the SysMLValidation constraints, and those of the rule packages named, reflectively to every element of a parsed model.

func (*Service) Supports added in v0.11.0

func (s *Service) Supports(capability string) bool

Supports reports whether the service has a capability, as GetServerInfo lists it; an in-process caller asks before choosing an RPC the way a remote client reads the advertised list first.

func (*Service) ValidateInstance

ValidateInstance checks every assertion about an object of the part named and the objects it holds, reporting one verdict per assertion beside a summary for the object.

func (*Service) VerifyConstraint

VerifyConstraint evaluates a constraint definition or usage, as the REPL's %constraint does.

func (*Service) VerifyRequirement

VerifyRequirement evaluates a requirement definition or usage, as the REPL's %requirement does.

func (*Service) VerifySatisfaction

VerifySatisfaction evaluates the satisfaction assertions a model states, as the REPL's %satisfy does: every one, or, given a symbol, the ones that element states — or that element itself when it is a named satisfy assertion.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is one retained run of a cached model: a runtime context of its own, with its clock, its scheduling policy and the objects it instantiated, that successive calls read and move along. It is the engine behind the public client's in-process session and exists only there; it has no RPC.

func (*Session) Accepts

func (ss *Session) Accepts(object int64, signalID string, args map[string]*pb.Value) (*SessionAcceptance, error)

Accepts decides what dispatching the signal to the object now would do, without dispatching it.

func (*Session) ActiveStates

func (ss *Session) ActiveStates(object int64) ([]string, error)

ActiveStates names the innermost active states of every machine the object exhibits, machine by machine in declaration order; the composite states enclosing them are active too.

func (*Session) Advance

func (ss *Session) Advance(seconds float64) (*SessionAdvance, error)

Advance moves the session's clock by seconds, dispatching what is due.

func (*Session) Close

func (ss *Session) Close()

Close releases the session's worker; a closed session refuses every call.

func (*Session) Evaluate

func (ss *Session) Evaluate(expression, contextSymbolID string) (*pb.Value, error)

Evaluate evaluates one expression in the scope of the named declaration, or of the model's primary document when none is named, against the session's state.

func (*Session) FeatureValue

func (ss *Session) FeatureValue(object int64, feature string) (*pb.FeatureValue, error)

FeatureValue reads one feature of an object the session holds.

func (*Session) Instantiate

func (ss *Session) Instantiate(symbolID string) (int64, error)

Instantiate instantiates the named part or usage in the session, starting the behaviors it exhibits, and answers the object's id.

func (*Session) Members

func (ss *Session) Members(symbolID string) ([]SessionMember, error)

Members lists the named members the named declaration's scope holds, in declaration order.

func (*Session) Now

func (ss *Session) Now() (float64, error)

Now is the session's clock.

func (*Session) Perform

func (ss *Session) Perform(object int64, actionID string, inputs map[string]*pb.Value) (*SessionPerformance, error)

Perform performs the named action on the object with the inputs, running it to completion, and reports what the run made and decided.

func (*Session) Send

func (ss *Session) Send(object int64, signalID string, args map[string]*pb.Value) (*SessionAcceptance, error)

Send posts the signal to the object, refusing one no machine would take or one every taking machine would drop; Advance then dispatches it.

func (*Session) SetFeatureValue

func (ss *Session) SetFeatureValue(object int64, feature string, value *pb.Value) error

SetFeatureValue writes one feature of an object the session holds.

func (*Session) SetSchedule

func (ss *Session) SetSchedule(spelling string) error

SetSchedule makes the session's later turns follow the scheduling policy: the actions it performs from now on, and the machines and clock it already drives from their next step on.

func (*Session) Transitions

func (ss *Session) Transitions(object int64) ([]SessionTransition, error)

Transitions lists the transitions dispatch could select now in every machine the object exhibits: out of each active state and then of each state enclosing it, innermost first, in declaration order.

type SessionAcceptance

type SessionAcceptance struct {
	// Accepted reports whether a transition of a taking machine is triggered by
	// the signal, whatever its guard.
	Accepted bool
	Fires    []SessionTransition
	Resumes  []string
}

SessionAcceptance is what dispatching a signal to an object now would do, read from the machines delivery would let take it; where several would, the schedule's due order decides which consumes it.

func (SessionAcceptance) Enabled

func (a SessionAcceptance) Enabled() bool

Enabled reports whether dispatching the signal would do something with it: fire or resume.

func (SessionAcceptance) Taken

func (a SessionAcceptance) Taken() bool

Taken reports whether a machine of the object would take the signal at all, be it to fire, resume, or drop it because every guard is false.

type SessionAdvance

type SessionAdvance struct {
	From, To    float64
	Events      int64
	Steps       int64
	Choices     []SessionChoice
	Diagnostics []*pb.Diagnostic
}

SessionAdvance is what advancing a session's clock reported.

type SessionBranch

type SessionBranch struct {
	Decision string
	Target   string
	Else     bool
	Opening  bool
}

SessionBranch is one way a performance left a decision of the action's own flow.

type SessionChoice

type SessionChoice struct {
	Kind         string
	Step         int
	Where        string
	Alternatives []string
	Taken        int
}

SessionChoice is one choice a run made, copied from the runtime's note.

type SessionFailure

type SessionFailure struct {
	Message     string
	Diagnostics []*pb.Diagnostic
}

SessionFailure is a session call the model answered with a failure — a name it does not declare, a run that failed — as distinct from a status the session refuses the call with.

func (*SessionFailure) Error

func (f *SessionFailure) Error() string

type SessionMember

type SessionMember struct {
	ID   string
	Name string
	Kind string
}

SessionMember is one named member a declaration's scope holds.

type SessionPerformance

type SessionPerformance struct {
	Outputs     map[string]*pb.Value
	Choices     []SessionChoice
	Branches    []SessionBranch
	Diagnostics []*pb.Diagnostic
}

SessionPerformance is what performing an action in a session reported.

type SessionTransition

type SessionTransition struct {
	Name    string
	Source  string
	Target  string
	Trigger string
	Signal  string
	Event   string
	Guarded bool
}

SessionTransition is one transition of a state machine as a session reports it: its ends and trigger by name, no node of the graph it was lowered to.

Jump to

Keyboard shortcuts

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