grpc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 41 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
)

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 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 names add-member and delete source authoring operations.

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 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 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 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 CapabilityFeatureValues = "feature_values"

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

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 CapabilityOSLCQuery = "oslc_query"

CapabilityOSLCQuery names the capability of evaluating OSLC Query text.

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 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 CapabilityRenderDocument = "render_document"

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

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 CapabilityTypeFacts = "type_facts"

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

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

Variables

View Source
var (
	// ErrQuantityNeedsIndex reports a quantity converted from the wire without
	// the model's symbols, which its base units can only be resolved against.
	ErrQuantityNeedsIndex = errors.New("a quantity needs the model's symbols to be converted from the wire")

	// ErrUnknownBaseUnit reports a base unit the model does not declare, so no
	// unit can be rebuilt from the reduction naming it.
	ErrUnknownBaseUnit = errors.New("unknown base unit")

	// ErrNotAMeasurementUnit reports a reduction naming a symbol that is not a
	// measurement unit, which nothing is measured in.
	ErrNotAMeasurementUnit = errors.New("not a measurement unit")

	// ErrUnitScaleUnusable reports a unit reduction whose scale is zero, undefined
	// or not finite, which no magnitude can be converted through.
	ErrUnitScaleUnusable = errors.New("unit scale is not a usable ratio")

	// ErrUnitExponentUnusable reports a unit factor raised to a power that is not
	// a finite number, which measures no dimension.
	ErrUnitExponentUnusable = errors.New("unit exponent is not a finite number")

	// ErrUnitNotReduced reports a named unit sent without its reduction, over
	// which alone commensurability is decided.
	ErrUnitNotReduced = errors.New("unit carries no reduction to base units")

	// ErrUnitTextMismatch reports a unit whose text names units that do not
	// reduce to the unit_term sent with it, so the two describe different units.
	ErrUnitTextMismatch = errors.New("unit as written does not reduce to its unit_term")
	// ErrUnsetNotAccepted reports the unset arm arriving as an input. It reports
	// that a feature value holds no value, which is something to read, not to supply.
	ErrUnsetNotAccepted = errors.New("unset is not a value a caller can supply")

	// ErrArrayDimensionNotPositive reports an array sent with a dimension of no
	// extent, which Collections::Array declares as dimensions: Positive.
	ErrArrayDimensionNotPositive = errors.New("array dimension is not positive")

	// ErrArrayShapeMismatch reports an array whose elements do not fill its
	// dimensions, so no row-major reading of them has that shape.
	ErrArrayShapeMismatch = errors.New("array elements do not fill its dimensions")

	// ErrVectorComponentNotNumeric reports a vector component sent as something
	// other than an Integer or a Real, which a numerical vector has none of.
	ErrVectorComponentNotNumeric = errors.New("vector component is not a number")

	// ErrVectorQuantityEmpty reports a vector quantity of no components, whose
	// num is Number[1..*].
	ErrVectorQuantityEmpty = errors.New("vector quantity has no components")

	// ErrMeasurementRefNeedsIndex reports a measurement reference converted from
	// the wire without the model's symbols, which its units resolve against.
	ErrMeasurementRefNeedsIndex = errors.New("a measurement reference needs the model's symbols to be converted from the wire")

	// ErrMeasurementRefEmpty reports a measurement reference sent with no unit
	// text, no reduction and no declaration: nothing it could refer to.
	ErrMeasurementRefEmpty = errors.New("measurement reference names no unit")

	// ErrUnknownMeasurementUnit reports a unit_id the model does not declare
	// uniquely, so no reference can name the declaration.
	ErrUnknownMeasurementUnit = errors.New("unknown measurement unit")

	// ErrUnitIDMismatch reports a unit_id whose declaration the unit text sent
	// with it does not spell, so the two name different units.
	ErrUnitIDMismatch = errors.New("unit as written does not spell unit_id")
)

Functions

func Capabilities

func Capabilities() []string

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

func CheckArrayShape added in v0.6.0

func CheckArrayShape(dimensions []int64, count int) error

CheckArrayShape reports whether count elements fill dimensions in row-major order: every dimension positive and their product (one for rank 0) count.

func ComplexToProto added in v0.5.0

func ComplexToProto(z complex128) *pb.Complex

ComplexToProto marshals a complex number as its rectangular parts.

func DiagnosticToProto

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

DiagnosticToProto converts a passes.Diagnostic to protobuf.

func InstanceGraphToProto

func InstanceGraphToProto(rt *runtime.Context, inst *runtime.Instance, idx *symbols.Index) (*pb.Instance, []*pb.Instance)

InstanceGraphToProto converts inst and every instance reachable from it. The root is returned first; runtime instances live only for the duration of a request, so the whole reachable graph is serialized while the context is alive.

Expansion stops at a child whose type is already on the path, at maxGraphDepth and at maxGraphInstances: reading a composite feature value materializes the object it holds, so a self-referential part would otherwise instantiate forever. An unexpanded child stays a bare instance id.

func InstanceToProto

func InstanceToProto(rt *runtime.Context, inst *runtime.Instance, idx *symbols.Index) *pb.Instance

InstanceToProto converts runtime.Instance to protobuf Instance. Feature values are read through Instance.GetFeatureValue, so a derived default is evaluated against the instance rather than reported as unmaterialized. Features are read in name order, because reading one materializes the object it holds, so map order would decide the ids those objects are given.

func MeasurementRefToProto added in v0.6.0

func MeasurementRefToProto(ref *runtime.MeasurementRef) *pb.MeasurementRef

MeasurementRefToProto marshals a bare reference: the unit as written, what it reduces to, and the one declaration it names when it names one.

func ParserDiagnosticToProto

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

ParserDiagnosticToProto converts a parser.Diagnostic to protobuf.

func ProtoToComplex added in v0.5.0

func ProtoToComplex(pc *pb.Complex) complex128

ProtoToComplex is the complex number a Complex message carries; an empty message is zero, as every proto3 default is.

func ProtoToMeasurementRef added in v0.6.0

func ProtoToMeasurementRef(pm *pb.MeasurementRef, idx *symbols.Index, sem *semantics.Model) (runtime.Value, error)

ProtoToMeasurementRef rebuilds a bare reference from the wire: by the declaration unit_id names, checked against the unit text and reduction sent with it, or else by the unit text read exactly as a Quantity's is.

func ProtoToQuantity

func ProtoToQuantity(pq *pb.Quantity, idx *symbols.Index, sem *semantics.Model) (runtime.Value, error)

ProtoToQuantity rebuilds a quantity from the wire: the magnitude as sent, in the unit as written — read as the product of the named units it composes, so an operation over it cancels and merges them — over the base units idx resolves its reduction to.

func ProtoToValueIn

func ProtoToValueIn(pv *pb.Value, idx *symbols.Index, sem *semantics.Model) (runtime.Value, error)

ProtoToValueIn converts a protobuf Value to a runtime.Value in the model idx and sem describe, resolving a quantity's base units against them. Inverse of ValueToProto.

func QuantityToProto

func QuantityToProto(q *runtime.Quantity) *pb.Quantity

QuantityToProto marshals a quantity: the magnitude in the unit written, plus what that unit reduces to. Reports nil for a magnitude that is not a number.

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 SymbolToProtoIn

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

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

func ValueCarriesComplex added in v0.5.0

func ValueCarriesComplex(pv *pb.Value) bool

ValueCarriesComplex reports whether a value, or any value nested in it, is a Complex: the kind the complex_values capability governs.

func ValueCarriesMeasurementRef added in v0.6.0

func ValueCarriesMeasurementRef(pv *pb.Value) bool

ValueCarriesMeasurementRef reports whether a value, or any value nested in it, is a MeasurementRef: the kind measurement_refs governs.

func ValueCarriesStructured added in v0.6.0

func ValueCarriesStructured(pv *pb.Value) bool

ValueCarriesStructured reports whether a value, or any value nested in it, is an Array, a Vector or a VectorQuantity: the kinds structured_values governs.

func ValueToProto

func ValueToProto(val runtime.Value, idx *symbols.Index) *pb.Value

ValueToProto converts runtime.Value to protobuf Value. An enumeration literal is named by its declaration, which idx supplies the qualified name of.

func ValueToProtoIn

func ValueToProtoIn(rt *runtime.Context, val runtime.Value, idx *symbols.Index) *pb.Value

ValueToProtoIn converts a value read from a live context, which is what tells an object holding no value from one with features: the former crosses as the unset arm, as every other surface reads it. rt may be nil for a value no context materialized.

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) 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 added in v0.4.2

type CachedDocument struct {
	Root        *ast.RootNamespace
	Source      *source.SourceFile  // For diagnostic line/col mapping
	ParseDiags  []parser.Diagnostic // Parser diagnostics
	PassesDiags []passes.Diagnostic // Semantic pass diagnostics (name-resolution, type, constraint)
}

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
	// contains filtered or unexported fields
}

CachedModel holds parsed model data with semantic analysis results

func (*CachedModel) DocumentRoots added in v0.4.2

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) Primary added in v0.4.2

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 added in v0.4.2

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

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

func (*CachedModel) RuntimeSemantics added in v0.5.0

func (m *CachedModel) RuntimeSemantics() (*runtimeSemantics, func())

RuntimeSemantics locks and returns the model's shared runtime resolver and semantic model, built on first use, with the function releasing them.

func (*CachedModel) SoleDocument added in v0.4.2

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

SoleDocument is the model's one document, for an operation defined on a single document's own source — editing it, or 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() *SymbolContext

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 added in v0.3.0

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 added in v0.3.0

func NewConnectAdapter(svc *Service) *ConnectAdapter

NewConnectAdapter wraps a Service as a Connect handler.

func (*ConnectAdapter) ApplyEdits added in v0.3.0

ApplyEdits edits a parsed model's own source.

func (*ConnectAdapter) Convert added in v0.3.0

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

func (*ConnectAdapter) Evaluate added in v0.3.0

Evaluate evaluates an expression against a parsed model.

func (*ConnectAdapter) EvaluateCalc added in v0.3.0

EvaluateCalc evaluates a calculation with the arguments given.

func (*ConnectAdapter) ExecuteAction added in v0.3.0

ExecuteAction runs an action to completion.

func (*ConnectAdapter) ExecuteState added in v0.3.0

ExecuteState runs a state machine over the events given.

func (*ConnectAdapter) GetDiagnostics added in v0.3.0

GetDiagnostics returns the diagnostics of a parsed model.

func (*ConnectAdapter) GetServerInfo added in v0.3.0

GetServerInfo reports what this build of the service can do.

func (*ConnectAdapter) GetSymbol added in v0.3.0

GetSymbol returns symbol information by qualified name.

func (*ConnectAdapter) Instantiate added in v0.3.0

Instantiate materializes an instance of a definition.

func (*ConnectAdapter) ParseFile added in v0.3.0

ParseFile parses a model and returns its hash.

func (*ConnectAdapter) ParseSources added in v0.4.2

ParseSources parses several documents as one model.

func (*ConnectAdapter) Query added in v0.3.0

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

func (*ConnectAdapter) RenderDocument added in v0.4.2

RenderDocument renders a named document to Markdown.

func (*ConnectAdapter) RunAnalysis added in v0.6.0

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

func (*ConnectAdapter) RunDocumentQuery added in v0.4.2

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

func (*ConnectAdapter) VerifyConstraint added in v0.3.0

VerifyConstraint evaluates a constraint and returns its verdict.

func (*ConnectAdapter) VerifyRequirement added in v0.3.0

VerifyRequirement evaluates a requirement and returns its verdict.

func (*ConnectAdapter) VerifySatisfaction added in v0.3.0

VerifySatisfaction evaluates satisfaction relationships in a model.

type GraphBounds added in v0.5.0

type GraphBounds struct {
	Depth     int
	Instances int
}

GraphBounds is how far InstanceGraphToProtoWithin expands an object graph: nested objects to Depth, and Instances objects in all.

func DefaultGraphBounds added in v0.5.0

func DefaultGraphBounds() GraphBounds

DefaultGraphBounds are the bounds the service serializes an instance graph under.

type InstanceGraph added in v0.5.0

type InstanceGraph struct {
	Root *pb.Instance
	All  []*pb.Instance // the root first
	// Truncated reports that the instance bound cut the graph short.
	Truncated bool
	// Errors are the typed failures behind every FeatureValue.Error in All.
	Errors []error
}

InstanceGraph is an object graph serialized by InstanceGraphToProtoWithin.

func InstanceGraphToProtoWithin added in v0.5.0

func InstanceGraphToProtoWithin(rt *runtime.Context, inst *runtime.Instance, idx *symbols.Index, bounds GraphBounds) InstanceGraph

InstanceGraphToProtoWithin is InstanceGraphToProto under the given bounds; the type cycle guard applies whatever the bounds.

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 > or < on a property that is not ordered.
	QueryErrUnorderedProperty
	// QueryErrUnparsableValue is an operand the operator cannot compare.
	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) (*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 holds anything but a positive integer, or if the prewarm setting is not a non-negative integer. 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 added in v0.3.0

func NewServiceWithUnavailableCapabilitiesForTesting(cacheSize int, version string, unavailable []string) (*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. Argument faults fail the call; an edit the engine refuses is reported in the response's error, failure kind and diagnostics.

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) 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) 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) 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) 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 added in v0.4.2

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) RenderDocument added in v0.4.2

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

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

func (*Service) RunAnalysis added in v0.6.0

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 added in v0.4.2

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

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 SymbolContext

type SymbolContext struct {
	Index     *symbols.Index
	Resolver  *resolve.Resolver
	Semantics *semantics.Model
	// contains filtered or unexported fields
}

SymbolContext holds what converting a symbol to proto needs besides the symbol: its index, and the resolver and semantic model that answer what its declared names refer to. Their memoization is why it is shared per model.

The resolver and semantic model memoize into plain maps, so a shared context must be used by one goroutine at a time; Lock serializes concurrent conversions of the same model.

func NewSymbolContext

func NewSymbolContext(idx *symbols.Index) *SymbolContext

NewSymbolContext builds a conversion context over a symbol index.

func (*SymbolContext) Lock

func (sc *SymbolContext) Lock() func()

Lock takes exclusive use of the context's resolver and semantic model, and returns the function releasing it.

Jump to

Keyboard shortcuts

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