Documentation
¶
Overview ¶
Package engine is an in-process engine over SysML text. It serves the execution RPCs of SysMLService — ParseSources, Evaluate, Instantiate, ExecuteAction and ExecuteState — with the same proto3 JSON answers as default-capabilities sysml-grpc, and also serves RenderView. The engine's RenderView JSON keeps its drawing shape (flattened fill/border and optional x/y/width/height), not the protojson of RenderViewResponse. WebAssembly clients decode the execution results with generated types they already hold, and no protobuf runtime is linked in, which keeps the js/wasm build small.
Index ¶
- type Engine
- type Error
- type F64
- type I64
- type JArray
- type JComplex
- type JDiagnostic
- type JEnumLiteral
- type JEvaluateRequest
- type JEvaluateResponse
- type JExecuteActionRequest
- type JExecuteActionResponse
- type JExecuteStateRequest
- type JExecuteStateResponse
- type JFeatureValue
- type JFunction
- type JInstance
- type JInstantiateRequest
- type JInstantiateResponse
- type JMeasurementRef
- type JMetaobject
- type JMultiplicityInfo
- type JParseSourcesRequest
- type JParseSourcesResponse
- type JQuantity
- type JRational
- type JRenderCanvas
- type JRenderEdge
- type JRenderNode
- type JRenderPoint
- type JRenderPort
- type JRenderRow
- type JRenderStyle
- type JRenderViewRequest
- type JRenderViewResponse
- type JSourceDocument
- type JSpan
- type JTensorQuantity
- type JTraceEvent
- type JUndetermined
- type JUnitFactor
- type JUnitTerm
- type JValue
- type JValueSequence
- type JValueSet
- type JVector
- type JVectorQuantity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine serves the execution RPCs of SysMLService over protojson-shaped JSON. Calls are handled sequentially in the caller's goroutine — deterministic and free of locking — so an Engine is not safe for concurrent use.
func New ¶
New builds an engine over the frozen standard library snapshot, under the runtime budgets a default sysml-grpc NewService runs with.
func NewWithLibrary ¶
NewWithLibrary builds an engine over a shared standard library snapshot. A nonpositive maxModels disables automatic eviction.
func (*Engine) Call ¶
Call runs the method named — a method name of SysMLService — on params, the protojson request body, and returns the protojson response body. A name the engine does not serve is refused Unimplemented, and a request that does not decode InvalidArgument, matching what stdiorpc's DiscardUnknown decode means by each.
func (*Engine) Serve ¶
Serve reads Content-Length-delimited frames from r and writes answers to w until r reaches its end, speaking the JSON half of stdiorpc's protocol: the same framing, envelope and error codes, with a protobuf frame refused since this product carries no protobuf. Calls are handled sequentially and answered in order.
type F64 ¶
type F64 float64
F64 is a proto3 double under protojson: a number, or the strings "NaN", "Infinity" and "-Infinity" that protojson uses where JSON has no spelling.
func (F64) MarshalJSON ¶
MarshalJSON writes the number, or the protojson string for a non-finite one.
func (*F64) UnmarshalJSON ¶
UnmarshalJSON reads the number, or one of the protojson non-finite spellings.
type I64 ¶
type I64 int64
I64 is a proto3 int64/uint64 under protojson: on the wire a decimal string. Input accepts the string or, as protojson does, the bare number.
func (I64) MarshalJSON ¶
MarshalJSON writes the decimal string protojson writes.
func (*I64) UnmarshalJSON ¶
UnmarshalJSON reads the decimal string, or the bare number.
type JDiagnostic ¶
type JDiagnostic = fsyntax.Diagnostic
JDiagnostic is the Diagnostic message, shaped in frontend/syntax where the syntactic command answers with it too.
type JEnumLiteral ¶
type JEvaluateRequest ¶
type JEvaluateResponse ¶
type JEvaluateResponse struct {
Result *JValue `json:"result,omitempty"`
Error string `json:"error,omitempty"`
Diagnostics []*JDiagnostic `json:"diagnostics,omitempty"`
}
type JExecuteActionRequest ¶
type JExecuteActionResponse ¶
type JExecuteActionResponse struct {
Outputs map[string]*JValue `json:"outputs,omitempty"`
Error string `json:"error,omitempty"`
Diagnostics []*JDiagnostic `json:"diagnostics,omitempty"`
FinalTime F64 `json:"finalTime,omitempty"`
PerformerAttributes map[string]*JValue `json:"performerAttributes,omitempty"`
}
type JExecuteStateRequest ¶
type JExecuteStateRequest struct {
ModelHash string `json:"modelHash,omitempty"`
StateMachineSymbolId string `json:"stateMachineSymbolId,omitempty"`
Events []string `json:"events,omitempty"`
Schedule string `json:"schedule,omitempty"`
PerformerSymbolId string `json:"performerSymbolId,omitempty"`
Trace bool `json:"trace,omitempty"`
}
type JExecuteStateResponse ¶
type JExecuteStateResponse struct {
StatesVisited []string `json:"statesVisited,omitempty"`
FinalContext map[string]*JValue `json:"finalContext,omitempty"`
Error string `json:"error,omitempty"`
Diagnostics []*JDiagnostic `json:"diagnostics,omitempty"`
FinalTime F64 `json:"finalTime,omitempty"`
Trace []JTraceEvent `json:"trace,omitempty"`
TraceDropped int `json:"traceDropped,omitempty"`
}
type JFeatureValue ¶
type JFeatureValue struct {
FeatureName string `json:"featureName,omitempty"`
Value *JValue `json:"value,omitempty"`
Values []*JValue `json:"values,omitempty"`
Materialized bool `json:"materialized,omitempty"`
Error string `json:"error,omitempty"`
}
JFeatureValue is the FeatureValue message.
type JInstance ¶
type JInstance struct {
Id I64 `json:"id,omitempty"`
TypeSymbolId string `json:"typeSymbolId,omitempty"`
FeatureValues map[string]*JFeatureValue `json:"featureValues,omitempty"`
}
JInstance is the Instance message.
type JInstantiateRequest ¶
type JInstantiateResponse ¶
type JInstantiateResponse struct {
Instance *JInstance `json:"instance,omitempty"`
Error string `json:"error,omitempty"`
Diagnostics []*JDiagnostic `json:"diagnostics,omitempty"`
Instances []*JInstance `json:"instances,omitempty"`
}
type JMeasurementRef ¶
type JMetaobject ¶
type JMultiplicityInfo ¶
type JParseSourcesRequest ¶
type JParseSourcesRequest struct {
Documents []*JSourceDocument `json:"documents,omitempty"`
StrictConformance bool `json:"strictConformance,omitempty"`
}
type JParseSourcesResponse ¶
type JParseSourcesResponse struct {
ModelHash string `json:"modelHash,omitempty"`
Diagnostics []*JDiagnostic `json:"diagnostics,omitempty"`
}
type JQuantity ¶
type JQuantity struct {
IntMagnitude *I64 `json:"intMagnitude,omitempty"`
RealMagnitude *F64 `json:"realMagnitude,omitempty"`
Unit string `json:"unit,omitempty"`
UnitTerm *JUnitTerm `json:"unitTerm,omitempty"`
BigIntMagnitude *string `json:"bigIntMagnitude,omitempty"`
RationalMagnitude *JRational `json:"rationalMagnitude,omitempty"`
}
JQuantity is the Quantity message; Magnitude is its oneof.
func (*JQuantity) UnmarshalJSON ¶
UnmarshalJSON rejects a quantity setting both magnitude arms of its oneof.
type JRational ¶
type JRational struct {
Numerator string `json:"numerator,omitempty"`
Denominator string `json:"denominator,omitempty"`
}
JRational is the Rational message: an exact rational in lowest terms.
type JRenderCanvas ¶
type JRenderEdge ¶
type JRenderEdge struct {
From string `json:"from"`
To string `json:"to"`
FromPort string `json:"fromPort,omitempty"`
ToPort string `json:"toPort,omitempty"`
Label string `json:"label"`
Kind string `json:"kind"`
Style *JRenderStyle `json:"style,omitempty"`
Route []JRenderPoint `json:"route,omitempty"`
}
type JRenderNode ¶
type JRenderNode struct {
ID string `json:"id"`
Kind string `json:"kind"`
Name string `json:"name"`
NameSynthesized bool `json:"nameSynthesized,omitempty"`
Type string `json:"type"`
Detail string `json:"detail"`
Parent string `json:"parent,omitempty"`
Fill string `json:"fill,omitempty"`
Border string `json:"border,omitempty"`
Style *JRenderStyle `json:"style,omitempty"`
X *float64 `json:"x,omitempty"`
Y *float64 `json:"y,omitempty"`
Width *float64 `json:"width,omitempty"`
Height *float64 `json:"height,omitempty"`
Collapsed bool `json:"collapsed,omitempty"`
Ports []JRenderPort `json:"ports,omitempty"`
}
type JRenderPoint ¶
type JRenderPort ¶
type JRenderRow ¶
type JRenderRow struct {
Cells []string `json:"cells"`
}
type JRenderStyle ¶
type JRenderViewRequest ¶
type JRenderViewResponse ¶
type JRenderViewResponse struct {
View string `json:"view"`
Kind string `json:"kind"`
Stated string `json:"stated"`
Notices []string `json:"notices"`
Canvas *JRenderCanvas `json:"canvas,omitempty"`
Nodes []JRenderNode `json:"nodes"`
Edges []JRenderEdge `json:"edges"`
Columns []string `json:"columns,omitempty"`
Rows []JRenderRow `json:"rows,omitempty"`
}
type JSourceDocument ¶
type JSourceDocument struct {
FilePath *string `json:"filePath,omitempty"`
Content *string `json:"content,omitempty"`
Language string `json:"language,omitempty"`
Name string `json:"name,omitempty"`
}
JSourceDocument is the SourceDocument message; Source is its oneof.
func (*JSourceDocument) UnmarshalJSON ¶
func (d *JSourceDocument) UnmarshalJSON(data []byte) error
UnmarshalJSON rejects a document naming both of its source arms.
type JTensorQuantity ¶
type JTraceEvent ¶
type JTraceEvent struct {
Kind string `json:"kind"`
At F64 `json:"at"`
Object string `json:"object,omitempty"`
Machine string `json:"machine,omitempty"`
State string `json:"state,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Target string `json:"target,omitempty"`
Event string `json:"event,omitempty"`
Payload []string `json:"payload,omitempty"`
Alternatives []string `json:"alternatives,omitempty"`
Taken string `json:"taken,omitempty"`
Text string `json:"text"`
}
JTraceEvent is one documented state-machine execution record.
type JUndetermined ¶
type JUndetermined struct {
Reason string `json:"reason,omitempty"`
Count *JMultiplicityInfo `json:"count,omitempty"`
}
type JUnitFactor ¶
type JUnitTerm ¶
type JUnitTerm struct {
ScaleNum F64 `json:"scaleNum,omitempty"`
ScaleDen F64 `json:"scaleDen,omitempty"`
Factors []*JUnitFactor `json:"factors,omitempty"`
}
type JValue ¶
type JValue struct {
IntValue *I64 `json:"intValue,omitempty"`
BigIntValue *string `json:"bigIntValue,omitempty"`
RealValue *F64 `json:"realValue,omitempty"`
BoolValue *bool `json:"boolValue,omitempty"`
StringValue *string `json:"stringValue,omitempty"`
InstanceId *I64 `json:"instanceId,omitempty"`
Sequence *JValueSequence `json:"sequence,omitempty"`
Null *string `json:"null,omitempty"`
Quantity *JQuantity `json:"quantity,omitempty"`
EnumLiteral *JEnumLiteral `json:"enumLiteral,omitempty"`
Unset *bool `json:"unset,omitempty"`
Complex *JComplex `json:"complex,omitempty"`
Array *JArray `json:"array,omitempty"`
Vector *JVector `json:"vector,omitempty"`
VectorQuantity *JVectorQuantity `json:"vectorQuantity,omitempty"`
MeasurementRef *JMeasurementRef `json:"measurementRef,omitempty"`
Infinity *bool `json:"infinity,omitempty"`
Function *JFunction `json:"function,omitempty"`
Set *JValueSet `json:"set,omitempty"`
TensorQuantity *JTensorQuantity `json:"tensorQuantity,omitempty"`
Metaobject *JMetaobject `json:"metaobject,omitempty"`
Undetermined *JUndetermined `json:"undetermined,omitempty"`
RationalValue *JRational `json:"rationalValue,omitempty"`
}
JValue is the Value message: a oneof, so exactly one arm is ever set.
func (*JValue) UnmarshalJSON ¶
UnmarshalJSON rejects a value setting two arms of the oneof, as protojson rejects it: a request naming more than one arm is ambiguous, not a pick.
type JValueSequence ¶
type JValueSequence struct {
Elements []*JValue `json:"elements,omitempty"`
}
type JVectorQuantity ¶
type JVectorQuantity struct {
Components []*JQuantity `json:"components,omitempty"`
}