Documentation
¶
Index ¶
- Constants
- func Capabilities() []string
- func DiagnosticToProto(diag diag.Diagnostic, sf *source.SourceFile) *pb.Diagnostic
- func NewSymbolContext(idx *symbols.Index) *symbolfacts.Context
- func ParserDiagnosticToProto(diag parser.Diagnostic, sf *source.SourceFile) *pb.Diagnostic
- func RunNoteDiagnosticsToProto(notes []runtime.RunNote, model *CachedModel) []*pb.Diagnostic
- func SymbolToProtoIn(sym *symbols.Symbol, sc *symbolfacts.Context) *pb.SymbolInfo
- func SymbolToProtoWith(sym *symbols.Symbol, sc *symbolfacts.Context, opts symbolfacts.Options) *pb.SymbolInfo
- func WithheldCapabilitiesForTesting() []string
- type Cache
- type CachedDocument
- type CachedModel
- func (m *CachedModel) DocumentRoots() []*symbols.Scope
- func (m *CachedModel) LookupDeclared(id string) []*symbols.Symbol
- func (m *CachedModel) LookupDeclaredMember(id string) []*symbols.Symbol
- func (m *CachedModel) LookupElementID(id string) []*symbols.Symbol
- func (m *CachedModel) LookupNamedMember(id string) []*symbols.Symbol
- func (m *CachedModel) LookupSymbol(id string) []*symbols.Symbol
- func (m *CachedModel) Primary() *CachedDocument
- func (m *CachedModel) PrimaryRoot() *symbols.Scope
- func (m *CachedModel) ResolveMemberName(name string) []*symbols.Symbol
- func (m *CachedModel) ResolveName(name string) []*symbols.Symbol
- func (m *CachedModel) ResolveQualifiedMemberName(name string) []*symbols.Symbol
- func (m *CachedModel) ResolveQualifiedName(name string) []*symbols.Symbol
- func (m *CachedModel) Semantics() (*runtime.Model, error)
- func (m *CachedModel) SoleDocument() (*CachedDocument, error)
- func (m *CachedModel) SymbolContext() *symbolfacts.Context
- type ConnectAdapter
- func (a *ConnectAdapter) ApplyEdits(ctx context.Context, req *connect.Request[pb.ApplyEditsRequest]) (*connect.Response[pb.ApplyEditsResponse], error)
- func (a *ConnectAdapter) CheckBehavior(ctx context.Context, req *connect.Request[pb.CheckBehaviorRequest]) (*connect.Response[pb.CheckBehaviorResponse], error)
- func (a *ConnectAdapter) CompareResults(ctx context.Context, req *connect.Request[pb.CompareResultsRequest]) (*connect.Response[pb.CompareResultsResponse], error)
- func (a *ConnectAdapter) Convert(ctx context.Context, req *connect.Request[pb.ConvertRequest]) (*connect.Response[pb.ConvertResponse], error)
- func (a *ConnectAdapter) Evaluate(ctx context.Context, req *connect.Request[pb.EvaluateRequest]) (*connect.Response[pb.EvaluateResponse], error)
- func (a *ConnectAdapter) EvaluateCalc(ctx context.Context, req *connect.Request[pb.EvaluateCalcRequest]) (*connect.Response[pb.EvaluateCalcResponse], error)
- func (a *ConnectAdapter) ExecuteAction(ctx context.Context, req *connect.Request[pb.ExecuteActionRequest]) (*connect.Response[pb.ExecuteActionResponse], error)
- func (a *ConnectAdapter) ExecuteState(ctx context.Context, req *connect.Request[pb.ExecuteStateRequest]) (*connect.Response[pb.ExecuteStateResponse], error)
- func (a *ConnectAdapter) ExportGraphs(ctx context.Context, req *connect.Request[pb.ExportGraphsRequest]) (*connect.Response[pb.ExportGraphsResponse], error)
- func (a *ConnectAdapter) GetDiagnostics(ctx context.Context, req *connect.Request[pb.DiagnosticsRequest]) (*connect.Response[pb.DiagnosticsResponse], error)
- func (a *ConnectAdapter) GetElementProperties(ctx context.Context, req *connect.Request[pb.GetElementPropertiesRequest]) (*connect.Response[pb.GetElementPropertiesResponse], error)
- func (a *ConnectAdapter) GetServerInfo(ctx context.Context, req *connect.Request[pb.ServerInfoRequest]) (*connect.Response[pb.ServerInfoResponse], error)
- func (a *ConnectAdapter) GetSymbol(ctx context.Context, req *connect.Request[pb.GetSymbolRequest]) (*connect.Response[pb.SymbolResponse], error)
- func (a *ConnectAdapter) ImportData(ctx context.Context, req *connect.Request[pb.ImportDataRequest]) (*connect.Response[pb.ImportDataResponse], error)
- func (a *ConnectAdapter) InstancePaths(ctx context.Context, req *connect.Request[pb.InstancePathsRequest]) (*connect.Response[pb.InstancePathsResponse], error)
- func (a *ConnectAdapter) Instantiate(ctx context.Context, req *connect.Request[pb.InstantiateRequest]) (*connect.Response[pb.InstantiateResponse], error)
- func (a *ConnectAdapter) ListEngines(ctx context.Context, req *connect.Request[pb.ListEnginesRequest]) (*connect.Response[pb.ListEnginesResponse], error)
- func (a *ConnectAdapter) Migrate(ctx context.Context, req *connect.Request[pb.MigrateRequest]) (*connect.Response[pb.MigrateResponse], error)
- func (a *ConnectAdapter) ParseFile(ctx context.Context, req *connect.Request[pb.ParseFileRequest]) (*connect.Response[pb.ParseFileResponse], error)
- func (a *ConnectAdapter) ParseSources(ctx context.Context, req *connect.Request[pb.ParseSourcesRequest]) (*connect.Response[pb.ParseSourcesResponse], error)
- func (a *ConnectAdapter) Query(ctx context.Context, req *connect.Request[pb.QueryRequest]) (*connect.Response[pb.QueryResponse], error)
- func (a *ConnectAdapter) RecordRun(ctx context.Context, req *connect.Request[pb.RecordRunRequest]) (*connect.Response[pb.RecordRunResponse], error)
- func (a *ConnectAdapter) RenderDocument(ctx context.Context, req *connect.Request[pb.RenderDocumentRequest]) (*connect.Response[pb.RenderDocumentResponse], error)
- func (a *ConnectAdapter) RenderView(ctx context.Context, req *connect.Request[pb.RenderViewRequest]) (*connect.Response[pb.RenderViewResponse], error)
- func (a *ConnectAdapter) RunAnalysis(ctx context.Context, req *connect.Request[pb.RunAnalysisRequest]) (*connect.Response[pb.RunAnalysisResponse], error)
- func (a *ConnectAdapter) RunDocumentQuery(ctx context.Context, req *connect.Request[pb.RunDocumentQueryRequest]) (*connect.Response[pb.RunDocumentQueryResponse], error)
- func (a *ConnectAdapter) RunRuns(ctx context.Context, req *connect.Request[pb.RunRunsRequest]) (*connect.Response[pb.RunRunsResponse], error)
- func (a *ConnectAdapter) RunSweep(ctx context.Context, req *connect.Request[pb.RunSweepRequest]) (*connect.Response[pb.RunSweepResponse], error)
- func (a *ConnectAdapter) SelfCheck(ctx context.Context, req *connect.Request[pb.SelfCheckRequest]) (*connect.Response[pb.SelfCheckResponse], error)
- func (a *ConnectAdapter) ValidateInstance(ctx context.Context, req *connect.Request[pb.ValidateInstanceRequest]) (*connect.Response[pb.ValidateInstanceResponse], error)
- func (a *ConnectAdapter) VerifyConstraint(ctx context.Context, req *connect.Request[pb.VerifyConstraintRequest]) (*connect.Response[pb.VerifyConstraintResponse], error)
- func (a *ConnectAdapter) VerifyRequirement(ctx context.Context, req *connect.Request[pb.VerifyRequirementRequest]) (*connect.Response[pb.VerifyRequirementResponse], error)
- func (a *ConnectAdapter) VerifySatisfaction(ctx context.Context, req *connect.Request[pb.VerifySatisfactionRequest]) (*connect.Response[pb.VerifySatisfactionResponse], error)
- type Option
- type QueryError
- type QueryErrorKind
- type Service
- func (s *Service) ApplyEdits(ctx context.Context, req *pb.ApplyEditsRequest) (*pb.ApplyEditsResponse, error)
- func (s *Service) CheckBehavior(ctx context.Context, req *pb.CheckBehaviorRequest) (*pb.CheckBehaviorResponse, error)
- func (s *Service) Close()
- func (s *Service) CompareResults(ctx context.Context, req *pb.CompareResultsRequest) (*pb.CompareResultsResponse, error)
- func (s *Service) Convert(ctx context.Context, req *pb.ConvertRequest) (*pb.ConvertResponse, error)
- func (s *Service) Evaluate(ctx context.Context, req *pb.EvaluateRequest) (*pb.EvaluateResponse, error)
- func (s *Service) EvaluateCalc(ctx context.Context, req *pb.EvaluateCalcRequest) (*pb.EvaluateCalcResponse, error)
- func (s *Service) ExecuteAction(ctx context.Context, req *pb.ExecuteActionRequest) (*pb.ExecuteActionResponse, error)
- func (s *Service) ExecuteState(ctx context.Context, req *pb.ExecuteStateRequest) (*pb.ExecuteStateResponse, error)
- func (s *Service) ExportGraphs(ctx context.Context, req *pb.ExportGraphsRequest) (*pb.ExportGraphsResponse, error)
- func (s *Service) GetDiagnostics(ctx context.Context, req *pb.DiagnosticsRequest) (*pb.DiagnosticsResponse, error)
- func (s *Service) GetElementProperties(ctx context.Context, req *pb.GetElementPropertiesRequest) (*pb.GetElementPropertiesResponse, error)
- func (s *Service) GetServerInfo(ctx context.Context, req *pb.ServerInfoRequest) (*pb.ServerInfoResponse, error)
- func (s *Service) GetSymbol(ctx context.Context, req *pb.GetSymbolRequest) (*pb.SymbolResponse, error)
- func (s *Service) ImportData(ctx context.Context, req *pb.ImportDataRequest) (*pb.ImportDataResponse, error)
- func (s *Service) InstancePaths(ctx context.Context, req *pb.InstancePathsRequest) (*pb.InstancePathsResponse, error)
- func (s *Service) Instantiate(ctx context.Context, req *pb.InstantiateRequest) (*pb.InstantiateResponse, error)
- func (s *Service) ListEngines(_ context.Context, req *pb.ListEnginesRequest) (*pb.ListEnginesResponse, error)
- func (s *Service) Migrate(ctx context.Context, req *pb.MigrateRequest) (*pb.MigrateResponse, error)
- func (s *Service) OpenSession(modelHash string) (*Session, error)
- func (s *Service) ParseFile(ctx context.Context, req *pb.ParseFileRequest) (*pb.ParseFileResponse, error)
- func (s *Service) ParseSources(ctx context.Context, req *pb.ParseSourcesRequest) (*pb.ParseSourcesResponse, error)
- func (s *Service) Prewarm() <-chan struct{}
- func (s *Service) Query(ctx context.Context, req *pb.QueryRequest) (*pb.QueryResponse, error)
- func (s *Service) RecordRun(ctx context.Context, req *pb.RecordRunRequest) (*pb.RecordRunResponse, error)
- func (s *Service) RenderDocument(ctx context.Context, req *pb.RenderDocumentRequest) (*pb.RenderDocumentResponse, error)
- func (s *Service) RenderView(ctx context.Context, req *pb.RenderViewRequest) (*pb.RenderViewResponse, error)
- func (s *Service) RunAnalysis(ctx context.Context, req *pb.RunAnalysisRequest) (*pb.RunAnalysisResponse, error)
- func (s *Service) RunDocumentQuery(ctx context.Context, req *pb.RunDocumentQueryRequest) (*pb.RunDocumentQueryResponse, error)
- func (s *Service) RunRuns(ctx context.Context, req *pb.RunRunsRequest) (*pb.RunRunsResponse, error)
- func (s *Service) RunSweep(ctx context.Context, req *pb.RunSweepRequest) (*pb.RunSweepResponse, error)
- func (s *Service) SelfCheck(ctx context.Context, req *pb.SelfCheckRequest) (*pb.SelfCheckResponse, error)
- func (s *Service) Supports(capability string) bool
- func (s *Service) ValidateInstance(ctx context.Context, req *pb.ValidateInstanceRequest) (*pb.ValidateInstanceResponse, error)
- func (s *Service) VerifyConstraint(ctx context.Context, req *pb.VerifyConstraintRequest) (*pb.VerifyConstraintResponse, error)
- func (s *Service) VerifyRequirement(ctx context.Context, req *pb.VerifyRequirementRequest) (*pb.VerifyRequirementResponse, error)
- func (s *Service) VerifySatisfaction(ctx context.Context, req *pb.VerifySatisfactionRequest) (*pb.VerifySatisfactionResponse, error)
- type Session
- func (ss *Session) Accepts(object int64, signalID string, args map[string]*pb.Value) (*SessionAcceptance, error)
- func (ss *Session) ActiveStates(object int64) ([]string, error)
- func (ss *Session) Advance(seconds float64) (*SessionAdvance, error)
- func (ss *Session) Close()
- func (ss *Session) Evaluate(expression, contextSymbolID string) (*pb.Value, error)
- func (ss *Session) FeatureValue(object int64, feature string) (*pb.FeatureValue, error)
- func (ss *Session) Instantiate(symbolID string) (int64, error)
- func (ss *Session) Members(symbolID string) ([]SessionMember, error)
- func (ss *Session) Now() (float64, error)
- func (ss *Session) Perform(object int64, actionID string, inputs map[string]*pb.Value) (*SessionPerformance, error)
- func (ss *Session) Send(object int64, signalID string, args map[string]*pb.Value) (*SessionAcceptance, error)
- func (ss *Session) SetFeatureValue(object int64, feature string, value *pb.Value) error
- func (ss *Session) SetSchedule(spelling string) error
- func (ss *Session) Transitions(object int64) ([]SessionTransition, error)
- type SessionAcceptance
- type SessionAdvance
- type SessionBranch
- type SessionChoice
- type SessionFailure
- type SessionMember
- type SessionPerformance
- type SessionTransition
Constants ¶
const ( QueryPropID = corequery.PropertyID QueryPropType = corequery.PropertyType QueryPropName = corequery.PropertyName QueryPropDeclaredName = corequery.PropertyDeclaredName QueryPropShortName = corequery.PropertyShortName QueryPropDeclaredShortName = corequery.PropertyDeclaredShortName QueryPropDocumentation = corequery.PropertyDocumentation QueryPropTextualRepresentation = corequery.PropertyTextualRepresentation QueryPropBody = corequery.PropertyBody QueryPropLocale = corequery.PropertyLocale QueryPropLanguage = corequery.PropertyLanguage QueryPropQualifiedName = corequery.PropertyQualifiedName QueryPropOwner = corequery.PropertyOwner QueryPropIsAbstract = corequery.PropertyIsAbstract QueryPropElementType = corequery.PropertyElementType QueryPropMultiplicityLower = corequery.PropertyMultiplicityLower QueryPropMultiplicityUpper = corequery.PropertyMultiplicityUpper QueryPropSatisfiedRequirement = corequery.PropertySatisfiedRequirement QueryPropSatisfyingFeature = corequery.PropertySatisfyingFeature QueryPropVerifiedRequirement = corequery.PropertyVerifiedRequirement QueryPropVerifyingCase = corequery.PropertyVerifyingCase QueryPropPayloadArgument = corequery.PropertyPayloadArgument QueryPropSenderArgument = corequery.PropertySenderArgument QueryPropReceiverArgument = corequery.PropertyReceiverArgument QueryPropSymbolKind = corequery.PropertySymbolKind QueryPropText = corequery.PropertyText )
Query property names, as the SysML v2 API & Services standard's clients write them. docs/reference/api.md documents what each one reports.
const ( TriggerCompletion = "completion" TriggerSignal = "signal" TriggerTime = "time" TriggerChange = "change" TriggerCall = "call" )
Trigger kinds a SessionTransition reports.
const CapabilityActionBodyStatementAuthoring = "action_body_statement_authoring"
CapabilityActionBodyStatementAuthoring names the extended action-body items and source-end multiplicities carried by add_sequence.
const CapabilityActionTrace = "action_trace"
CapabilityActionTrace names the ExecuteAction trace request field.
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.
const CapabilityAuthoring = "authoring"
CapabilityAuthoring gates source-authoring ApplyEdits operations; dedicated capabilities further gate specialized authoring operations.
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.
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.
const CapabilityCheck = "check"
CapabilityCheck names the CheckBehavior RPC, which searches every schedule of a behavior for violated properties, deadlocks, failures and divergent values.
const CapabilityCommentAuthoring = "comment_authoring"
CapabilityCommentAuthoring names the ApplyEdits add_comment and add_note operations.
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'.
const CapabilityComplexValues = "complex_values"
CapabilityComplexValues names the capability of carrying a complex number as Value.complex, rather than reporting it as an unsupported null.
const CapabilityConnectionAuthoring = "connection_authoring"
CapabilityConnectionAuthoring names the ApplyEdits add_connection operation.
const CapabilityConstraintBodyAuthoring = "constraint_body_authoring"
CapabilityConstraintBodyAuthoring names constraint body expressions and asserted constraints.
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.
const CapabilityConvertCheckDiagnostics = "convert_check_diagnostics"
CapabilityConvertCheckDiagnostics names ConvertRequest.include_check_diagnostics: the semantic check's diagnostics, with their severities, reported alongside the converted output.
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.
const CapabilityConvertDocuments = "convert_documents"
CapabilityConvertDocuments names ConvertRequest.documents, which writes only the named documents of a model and links the rest by id.
const CapabilityConvertInheritedMembers = "convert_inherited_members"
CapabilityConvertInheritedMembers names ConvertRequest.inherited_members; a service without it writes the inherited member lists on every api-json element.
const CapabilityConvertLibraryReferences = "convert_library_references"
CapabilityConvertLibraryReferences names ConvertResponse.library_references.
const CapabilityConvertLibraryStubs = "convert_library_stubs"
CapabilityConvertLibraryStubs names ConvertRequest.include_library_stubs.
const CapabilityCoordinateFrameValues = "coordinate_frame_values"
CapabilityCoordinateFrameValues names the capability of carrying a coordinate frame and a coordinate transformation on their own Value arms rather than as unsupported nulls.
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.
const CapabilityDocumentQuery = "document_query"
CapabilityDocumentQuery names the capability of the RunDocumentQuery RPC, which runs a named document query and answers with typed rows.
const CapabilityDocumentationAuthoring = "documentation_authoring"
CapabilityDocumentationAuthoring names the ApplyEdits add_documentation operation and the AddMember doc field.
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.
const CapabilityElementProperties = "element_properties"
CapabilityElementProperties names the GetElementProperties RPC, which reads the metamodel properties of one element by their specification names.
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.
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`.
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.
const CapabilityEvaluateSubject = "evaluate_subject"
CapabilityEvaluateSubject names the capability of evaluating an expression against an instantiated subject.
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.
const CapabilityFeatureValues = "feature_values"
CapabilityFeatureValues names the capability of populating Instance.feature_values, which replaced the pre-0.1.0 Instance.slots.
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.
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.
const CapabilityImplicitParameters = "implicit_parameters"
CapabilityImplicitParameters names the ApplyEdits add_member operation with no kind: an implicit directed usage (`in x : T;`).
const CapabilityImportAuthoring = "import_authoring"
CapabilityImportAuthoring names the ApplyEdits add_import operation.
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.
const CapabilityInfinityValue = "infinity_value"
CapabilityInfinityValue names the capability of carrying the unbounded value `*` as Value.infinity, rather than reporting it as an unsupported null.
const CapabilityInlineDocumentQuery = "inline_document_query"
CapabilityInlineDocumentQuery names RunDocumentQueryRequest.inline_query: a query expression run in place of a named query, planned by the same compiler.
const CapabilityInlineLanguage = "inline_language"
CapabilityInlineLanguage names explicit language selection for inline content.
const CapabilityInstancePaths = "instance_paths"
CapabilityInstancePaths names the InstancePaths RPC, which lists every root-relative path reaching an object, and the `reached_by` of an Instance in an instantiated graph, which says how the traversal reached it.
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.
const CapabilityMemberModifiers = "member_modifiers"
CapabilityMemberModifiers names the additional AddMember modifiers and kinds.
const CapabilityMetadataAuthoring = "metadata_authoring"
CapabilityMetadataAuthoring names metadata usages and metadata prefixes.
const CapabilityMetadataPrefixAuthoring = "metadata_prefix_authoring"
CapabilityMetadataPrefixAuthoring names edits that add metadata to an existing declaration.
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.
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.
const CapabilityOSLCQuery = "oslc_query"
CapabilityOSLCQuery names the capability of evaluating OSLC Query text.
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.
const CapabilityParseSources = "parse_sources"
CapabilityParseSources names the ParseSources RPC, which parses several documents as one model so a name one declares resolves in another.
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.
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.
const CapabilityQuery = "query"
CapabilityQuery names the capability of the Query RPC, which evaluates a SysML v2 API & Services Query over a parsed model.
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.
const CapabilityQueryResultView = "query_result_view"
CapabilityQueryResultView names the as_view fields of RunDocumentQueryRequest and QueryRequest, which write an answer as a QVTS::QueryResult view, and RenderView's header and form for one.
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.
const CapabilityRecordRun = "record_run"
CapabilityRecordRun names the RecordRun RPC, which records runs of an analysis case into the model as AnalysisRecords declarations.
const CapabilityRenderDocument = "render_document"
CapabilityRenderDocument names the capability of the RenderDocument RPC, which renders a named document to Markdown.
const CapabilityRenderDocumentAsciiDoc = "render_document_asciidoc"
CapabilityRenderDocumentAsciiDoc names the capability of RenderDocumentRequest's form field taking "asciidoc", answered in RenderDocumentResponse.asciidoc.
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.
const CapabilityRenderDocumentHTML = "render_document_html"
CapabilityRenderDocumentHTML names the capability of RenderDocumentRequest's form field, which asks RenderDocument for HTML instead of Markdown.
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.
const CapabilityRenderViewForm = "render_view_form"
CapabilityRenderViewForm names the capability of RenderViewRequest's form field and writer options, answered in RenderViewResponse.text.
const CapabilityRequirementConstraintAuthoring = "requirement_constraint_authoring"
CapabilityRequirementConstraintAuthoring names the ApplyEdits add_requirement_constraint operation.
const CapabilityRuns = "runs"
CapabilityRuns names the RunRuns RPC, which runs an action or a Monte Carlo case repeatedly and tables what the runs observed.
const CapabilitySatisfyAuthoring = "satisfy_authoring"
CapabilitySatisfyAuthoring names the ApplyEdits add_satisfy operation.
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.
const CapabilityScheduleExplore = "schedule_explore"
CapabilityScheduleExplore names the capability of answering a request under `explore[:runs=<n>,depth=<d>]` with `outcomes` and an `exploration` status.
const CapabilitySelfCheck = "self_check"
CapabilitySelfCheck names the SelfCheck RPC, which applies the reflective SysMLValidation constraints to every element of a model.
const CapabilitySequenceAuthoring = "sequence_authoring"
CapabilitySequenceAuthoring names the ApplyEdits add_sequence operation.
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.
const CapabilityStateActionAuthoring = "state_action_authoring"
CapabilityStateActionAuthoring names state behavior member kinds.
const CapabilityStateTrace = "state_trace"
CapabilityStateTrace names the ExecuteState trace request field.
const CapabilityStrictConformance = "strict_conformance"
CapabilityStrictConformance names ParseFileRequest.strict_conformance, which asks whether the source is conforming SysML v2.
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.
const CapabilitySymbolAnnotatingMetadata = "symbol_annotating_metadata"
CapabilitySymbolAnnotatingMetadata names the capability of populating SymbolInfo.annotating_metadata_ids, the metadata usages annotating the element.
const CapabilitySymbolAttributes = "symbol_attributes"
CapabilitySymbolAttributes names the capability of populating SymbolInfo.attributes, rather than always reporting none.
const CapabilitySymbolLookupKind = "symbol_lookup_kind"
CapabilitySymbolLookupKind names the capability of honouring the lookup of GetSymbolRequest and GetElementPropertiesRequest: a qualified name read only as a name, an element id only as an id.
const CapabilitySymbolMemberDirection = "symbol_member_direction"
CapabilitySymbolMemberDirection names the capability of honouring GetSymbolRequest.member_of, reporting a feature's direction relative to that type.
const CapabilitySymbolMembers = "symbol_members"
CapabilitySymbolMembers names the capability of populating SymbolInfo.members, the element's members own and inherited with their provenance, and of honouring GetSymbolRequest.include_library_members.
const CapabilitySymbolNameResolution = "symbol_name_resolution"
CapabilitySymbolNameResolution names the capability of honouring GetSymbolRequest.resolve_name; without it symbol_id is read as an id the service reported, as a service predating the field reads it.
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.
const CapabilityTransitionAuthoring = "transition_authoring"
CapabilityTransitionAuthoring names the ApplyEdits add_transition operation.
const CapabilityTypeFacts = "type_facts"
CapabilityTypeFacts names the capability of populating SymbolInfo.type_info, .multiplicity and .specializations, which typed code generation requires.
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.
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.
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.
const CapabilityVerification = "verification"
CapabilityVerification names the capability of the verification RPCs, which answer the questions the REPL's %constraint, %requirement, %satisfy and %calc answer.
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.
const CapabilityVerificationObjectiveAuthoring = "verification_objective_authoring"
CapabilityVerificationObjectiveAuthoring names verification-case objective authoring.
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.
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.
const DefaultIndexPrewarm = 4
DefaultIndexPrewarm is the value IndexPrewarmEnvVar takes when unset: any positive value prewarms, since one library index now serves every model.
const DefaultMaxHeldEvents = 100000
DefaultMaxHeldEvents is the bound HeldEventsEnvVar takes when unset.
const DefaultMaxHeldObjects = 10000
DefaultMaxHeldObjects is the bound HeldObjectsEnvVar takes when unset.
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.
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.
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.
const SyntaxDiagnosticCode = parser.CodeSyntax
SyntaxDiagnosticCode is the code a parser error is reported under when the parser gave it none of its own.
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 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 SymbolToProtoWith ¶ added in v0.13.0
func SymbolToProtoWith(sym *symbols.Symbol, sc *symbolfacts.Context, opts symbolfacts.Options) *pb.SymbolInfo
SymbolToProtoWith is SymbolToProtoIn with the options selecting what else the facts report.
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 ¶
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) LookupDeclared ¶ added in v0.13.0
func (m *CachedModel) LookupDeclared(id string) []*symbols.Symbol
LookupDeclared resolves a symbol id as a declared name, else as the id the service reports its element under (symbolfacts.Context.LookupDeclared), under the symbol context's lock.
func (*CachedModel) LookupDeclaredMember ¶ added in v0.13.0
func (m *CachedModel) LookupDeclaredMember(id string) []*symbols.Symbol
LookupDeclaredMember is LookupDeclared with an inherited member (Sub::inherited) read as a name too (symbolfacts.Context.LookupDeclaredMember), under the symbol context's lock.
func (*CachedModel) LookupElementID ¶ added in v0.13.0
func (m *CachedModel) LookupElementID(id string) []*symbols.Symbol
LookupElementID finds the element the service reports under an id and nothing else (see symbolfacts.Context.LookupID), under the symbol context's lock.
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) LookupSymbol ¶ added in v0.13.0
func (m *CachedModel) LookupSymbol(id string) []*symbols.Symbol
LookupSymbol reads a string stated without a lookup kind (symbolfacts.Context.Lookup), 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) ResolveMemberName ¶ added in v0.13.0
func (m *CachedModel) ResolveMemberName(name string) []*symbols.Symbol
ResolveMemberName is ResolveName with an alias answered as its membership (see symbolfacts.Context.ResolveMember).
func (*CachedModel) ResolveName ¶ added in v0.13.0
func (m *CachedModel) ResolveName(name string) []*symbols.Symbol
ResolveName reads a string stated without a lookup kind as a qualified name from the root first, then as an id (see symbolfacts.Context.Resolve), under the symbol context's lock.
func (*CachedModel) ResolveQualifiedMemberName ¶ added in v0.13.0
func (m *CachedModel) ResolveQualifiedMemberName(name string) []*symbols.Symbol
ResolveQualifiedMemberName is ResolveQualifiedName with an alias answered as its membership (see symbolfacts.Context.ResolveMemberName).
func (*CachedModel) ResolveQualifiedName ¶ added in v0.13.0
func (m *CachedModel) ResolveQualifiedName(name string) []*symbols.Symbol
ResolveQualifiedName resolves a qualified name and nothing else (see symbolfacts.Context.ResolveName), under the symbol context's lock.
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 ¶
func (a *ConnectAdapter) ApplyEdits(ctx context.Context, req *connect.Request[pb.ApplyEditsRequest]) (*connect.Response[pb.ApplyEditsResponse], error)
ApplyEdits edits a parsed model's own source.
func (*ConnectAdapter) CheckBehavior ¶ added in v0.11.0
func (a *ConnectAdapter) CheckBehavior(ctx context.Context, req *connect.Request[pb.CheckBehaviorRequest]) (*connect.Response[pb.CheckBehaviorResponse], error)
func (*ConnectAdapter) CompareResults ¶ added in v0.11.0
func (a *ConnectAdapter) CompareResults(ctx context.Context, req *connect.Request[pb.CompareResultsRequest]) (*connect.Response[pb.CompareResultsResponse], error)
CompareResults runs the configurations a results sidecar indexes and compares the runs with the tool's.
func (*ConnectAdapter) Convert ¶
func (a *ConnectAdapter) Convert(ctx context.Context, req *connect.Request[pb.ConvertRequest]) (*connect.Response[pb.ConvertResponse], error)
Convert writes a model out as SysML notation or RDF Turtle.
func (*ConnectAdapter) Evaluate ¶
func (a *ConnectAdapter) Evaluate(ctx context.Context, req *connect.Request[pb.EvaluateRequest]) (*connect.Response[pb.EvaluateResponse], error)
Evaluate evaluates an expression against a parsed model.
func (*ConnectAdapter) EvaluateCalc ¶
func (a *ConnectAdapter) EvaluateCalc(ctx context.Context, req *connect.Request[pb.EvaluateCalcRequest]) (*connect.Response[pb.EvaluateCalcResponse], error)
EvaluateCalc evaluates a calculation with the arguments given.
func (*ConnectAdapter) ExecuteAction ¶
func (a *ConnectAdapter) ExecuteAction(ctx context.Context, req *connect.Request[pb.ExecuteActionRequest]) (*connect.Response[pb.ExecuteActionResponse], error)
ExecuteAction runs an action to completion.
func (*ConnectAdapter) ExecuteState ¶
func (a *ConnectAdapter) ExecuteState(ctx context.Context, req *connect.Request[pb.ExecuteStateRequest]) (*connect.Response[pb.ExecuteStateResponse], error)
ExecuteState runs a state machine over the events given.
func (*ConnectAdapter) ExportGraphs ¶ added in v0.10.0
func (a *ConnectAdapter) ExportGraphs(ctx context.Context, req *connect.Request[pb.ExportGraphsRequest]) (*connect.Response[pb.ExportGraphsResponse], error)
ExportGraphs exports the lowered graph of an action or state machine as graphs:1 JSON.
func (*ConnectAdapter) GetDiagnostics ¶
func (a *ConnectAdapter) GetDiagnostics(ctx context.Context, req *connect.Request[pb.DiagnosticsRequest]) (*connect.Response[pb.DiagnosticsResponse], error)
GetDiagnostics returns the diagnostics of a parsed model.
func (*ConnectAdapter) GetElementProperties ¶ added in v0.13.0
func (a *ConnectAdapter) GetElementProperties(ctx context.Context, req *connect.Request[pb.GetElementPropertiesRequest]) (*connect.Response[pb.GetElementPropertiesResponse], error)
GetElementProperties reads the metamodel properties of one element.
func (*ConnectAdapter) GetServerInfo ¶
func (a *ConnectAdapter) GetServerInfo(ctx context.Context, req *connect.Request[pb.ServerInfoRequest]) (*connect.Response[pb.ServerInfoResponse], error)
GetServerInfo reports what this build of the service can do.
func (*ConnectAdapter) GetSymbol ¶
func (a *ConnectAdapter) GetSymbol(ctx context.Context, req *connect.Request[pb.GetSymbolRequest]) (*connect.Response[pb.SymbolResponse], error)
GetSymbol returns symbol information by qualified name.
func (*ConnectAdapter) ImportData ¶ added in v0.11.0
func (a *ConnectAdapter) ImportData(ctx context.Context, req *connect.Request[pb.ImportDataRequest]) (*connect.Response[pb.ImportDataResponse], error)
ImportData sets the feature values data files assign, as `sysml -import` does.
func (*ConnectAdapter) InstancePaths ¶ added in v0.13.0
func (a *ConnectAdapter) InstancePaths(ctx context.Context, req *connect.Request[pb.InstancePathsRequest]) (*connect.Response[pb.InstancePathsResponse], error)
InstancePaths lists every root-relative path reaching an object.
func (*ConnectAdapter) Instantiate ¶
func (a *ConnectAdapter) Instantiate(ctx context.Context, req *connect.Request[pb.InstantiateRequest]) (*connect.Response[pb.InstantiateResponse], error)
Instantiate materializes an instance of a definition.
func (*ConnectAdapter) ListEngines ¶
func (a *ConnectAdapter) ListEngines(ctx context.Context, req *connect.Request[pb.ListEnginesRequest]) (*connect.Response[pb.ListEnginesResponse], error)
ListEngines lists the analysis engines this build registers.
func (*ConnectAdapter) Migrate ¶ added in v0.10.0
func (a *ConnectAdapter) Migrate(ctx context.Context, req *connect.Request[pb.MigrateRequest]) (*connect.Response[pb.MigrateResponse], error)
Migrate writes a SysML v1 model out as a v2 one, with the report of what became of every v1 element.
func (*ConnectAdapter) ParseFile ¶
func (a *ConnectAdapter) ParseFile(ctx context.Context, req *connect.Request[pb.ParseFileRequest]) (*connect.Response[pb.ParseFileResponse], error)
ParseFile parses a model and returns its hash.
func (*ConnectAdapter) ParseSources ¶
func (a *ConnectAdapter) ParseSources(ctx context.Context, req *connect.Request[pb.ParseSourcesRequest]) (*connect.Response[pb.ParseSourcesResponse], error)
ParseSources parses several documents as one model.
func (*ConnectAdapter) Query ¶
func (a *ConnectAdapter) Query(ctx context.Context, req *connect.Request[pb.QueryRequest]) (*connect.Response[pb.QueryResponse], error)
Query evaluates a SysML v2 API & Services Query over a parsed model.
func (*ConnectAdapter) RecordRun ¶ added in v0.11.0
func (a *ConnectAdapter) RecordRun(ctx context.Context, req *connect.Request[pb.RecordRunRequest]) (*connect.Response[pb.RecordRunResponse], error)
RecordRun runs an analysis case and records the runs into the model.
func (*ConnectAdapter) RenderDocument ¶
func (a *ConnectAdapter) RenderDocument(ctx context.Context, req *connect.Request[pb.RenderDocumentRequest]) (*connect.Response[pb.RenderDocumentResponse], error)
RenderDocument renders a named document to Markdown.
func (*ConnectAdapter) RenderView ¶ added in v0.10.0
func (a *ConnectAdapter) RenderView(ctx context.Context, req *connect.Request[pb.RenderViewRequest]) (*connect.Response[pb.RenderViewResponse], error)
RenderView renders a named view or targeted pseudo-view as diagram data.
func (*ConnectAdapter) RunAnalysis ¶
func (a *ConnectAdapter) RunAnalysis(ctx context.Context, req *connect.Request[pb.RunAnalysisRequest]) (*connect.Response[pb.RunAnalysisResponse], error)
RunAnalysis runs an analysis case with the subject and arguments given.
func (*ConnectAdapter) RunDocumentQuery ¶
func (a *ConnectAdapter) RunDocumentQuery(ctx context.Context, req *connect.Request[pb.RunDocumentQueryRequest]) (*connect.Response[pb.RunDocumentQueryResponse], error)
RunDocumentQuery runs a named document query and answers with typed rows.
func (*ConnectAdapter) RunRuns ¶ added in v0.11.0
func (a *ConnectAdapter) RunRuns(ctx context.Context, req *connect.Request[pb.RunRunsRequest]) (*connect.Response[pb.RunRunsResponse], error)
RunRuns runs an action or a Monte Carlo case repeatedly and tables the runs.
func (*ConnectAdapter) RunSweep ¶
func (a *ConnectAdapter) RunSweep(ctx context.Context, req *connect.Request[pb.RunSweepRequest]) (*connect.Response[pb.RunSweepResponse], error)
RunSweep runs one analysis case or calc once per row of a parameter sweep.
func (*ConnectAdapter) SelfCheck ¶ added in v0.11.0
func (a *ConnectAdapter) SelfCheck(ctx context.Context, req *connect.Request[pb.SelfCheckRequest]) (*connect.Response[pb.SelfCheckResponse], error)
SelfCheck applies the reflective SysMLValidation constraints to every element of a model.
func (*ConnectAdapter) ValidateInstance ¶
func (a *ConnectAdapter) ValidateInstance(ctx context.Context, req *connect.Request[pb.ValidateInstanceRequest]) (*connect.Response[pb.ValidateInstanceResponse], error)
ValidateInstance checks every assertion about an object and the objects it holds.
func (*ConnectAdapter) VerifyConstraint ¶
func (a *ConnectAdapter) VerifyConstraint(ctx context.Context, req *connect.Request[pb.VerifyConstraintRequest]) (*connect.Response[pb.VerifyConstraintResponse], error)
VerifyConstraint evaluates a constraint and returns its verdict.
func (*ConnectAdapter) VerifyRequirement ¶
func (a *ConnectAdapter) VerifyRequirement(ctx context.Context, req *connect.Request[pb.VerifyRequirementRequest]) (*connect.Response[pb.VerifyRequirementResponse], error)
VerifyRequirement evaluates a requirement and returns its verdict.
func (*ConnectAdapter) VerifySatisfaction ¶
func (a *ConnectAdapter) VerifySatisfaction(ctx context.Context, req *connect.Request[pb.VerifySatisfactionRequest]) (*connect.Response[pb.VerifySatisfactionResponse], error)
VerifySatisfaction evaluates satisfaction relationships in a model.
type Option ¶
type Option func(*serviceOptions)
Option adjusts how NewService builds a service.
func ConfineFilesTo ¶ added in v0.13.0
ConfineFilesTo has the service read a file a request names by path only under dir, symbolic links followed; without it the service reads any path its privileges reach.
func ServeExternalEngines ¶
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.
func WithRecordCache ¶ added in v0.13.0
WithRecordCache has the service read a parsed model's analysis from cache when one is recorded there, and record what it analyzes itself; a nil cache is none.
type QueryError ¶
type QueryError struct {
Kind QueryErrorKind
Message string
// Err is the translator's or the evaluator's own fault, kept for its kind.
Err error
}
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
func (*QueryError) Unwrap ¶ added in v0.13.0
func (e *QueryError) Unwrap() error
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 the metamodel does not define. QueryErrUnknownProperty QueryErrorKind = iota + 1 // QueryErrMalformedConstraint is a constraint with no form, no operator or // no operand, or query text that does not parse. 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 // QueryErrUnsupported is a construct the query language does not define or // this service does not evaluate, such as "or" in OSLC text. QueryErrUnsupported // QueryErrEvaluation is a query the plan refused while reading the model: // the QVTS record of the failure is attached as a QueryOutcome detail. QueryErrEvaluation )
type Service ¶
type Service struct {
pb.UnimplementedSysMLServiceServer
// contains filtered or unexported fields
}
Service implements SysMLServiceServer
func NewService ¶
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) GetElementProperties ¶ added in v0.13.0
func (s *Service) GetElementProperties(ctx context.Context, req *pb.GetElementPropertiesRequest) (*pb.GetElementPropertiesResponse, error)
GetElementProperties reads one element's metamodel properties by their specification names over the symbols the model resolved to (metamodel.SymbolStructure), a library element from its document's form; an excluded document's element answers its error.
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 qualified name or by element id, as the request's lookup states; without one, symbol_id is read name first, then id.
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) InstancePaths ¶ added in v0.13.0
func (s *Service) InstancePaths(ctx context.Context, req *pb.InstancePathsRequest) (*pb.InstancePathsResponse, error)
InstancePaths lists every root-relative path that reaches the object the request names, from each root the model's population holds, in traversal order (see runtime.Context.PathsTo).
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 ¶
func (s *Service) ListEngines(_ context.Context, req *pb.ListEnginesRequest) (*pb.ListEnginesResponse, error)
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 every v1 element. Argument faults fail the call; a refused model is reported in the response's error.
func (*Service) OpenSession ¶
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() <-chan struct{}
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, or OSLC Query 3.0 text, over a parsed model: either is translated to a document-query plan and run by the evaluator over the model's elements, or the objects the model's session holds.
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 ¶
func (s *Service) RunDocumentQuery(ctx context.Context, req *pb.RunDocumentQueryRequest) (*pb.RunDocumentQueryResponse, error)
RunDocumentQuery runs a named document query, or a query expression written in place of a name, 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
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 ¶
func (s *Service) ValidateInstance(ctx context.Context, req *pb.ValidateInstanceRequest) (*pb.ValidateInstanceResponse, error)
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 ¶
func (s *Service) VerifyConstraint(ctx context.Context, req *pb.VerifyConstraintRequest) (*pb.VerifyConstraintResponse, error)
VerifyConstraint evaluates a constraint definition or usage, as the REPL's %constraint does.
func (*Service) VerifyRequirement ¶
func (s *Service) VerifyRequirement(ctx context.Context, req *pb.VerifyRequirementRequest) (*pb.VerifyRequirementResponse, error)
VerifyRequirement evaluates a requirement definition or usage, as the REPL's %requirement does.
func (*Service) VerifySatisfaction ¶
func (s *Service) VerifySatisfaction(ctx context.Context, req *pb.VerifySatisfactionRequest) (*pb.VerifySatisfactionResponse, error)
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 ¶
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 ¶
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 ¶
FeatureValue reads one feature of an object the session holds.
func (*Session) Instantiate ¶
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) 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 ¶
SetFeatureValue writes one feature of an object the session holds.
func (*Session) SetSchedule ¶
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 ¶
SessionBranch is one way a performance left a decision of the action's own flow.
type SessionChoice ¶
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 ¶
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.
Source Files
¶
- analysis.go
- cache.go
- capability_response.go
- check.go
- compare.go
- connect.go
- convert.go
- coverage.go
- docquery.go
- edit.go
- element_properties.go
- engines.go
- explore.go
- export.go
- export_graphs.go
- file_root.go
- importdata.go
- instancepaths.go
- libindex.go
- lineage.go
- migrate.go
- modelrecord.go
- objects.go
- query.go
- record.go
- render_view.go
- resultview.go
- run_options.go
- runs.go
- selfcheck.go
- service.go
- session.go
- sweep.go
- symbolcontext.go
- tooldryrun.go
- validate.go
- verify.go
- verify_questions.go