Protocol
Namespace: E2E.Engine.Protocol
public static class ProtocolThe engine protocol: the engine contract as messages, so an engine can run in another process, on another machine, or be written in
another language. It follows the Language Server Protocol: the base layer is LSP’s (Connection), a connection opens
with initialize/initialized and ends with shutdown/exit, and the server announces what it answers in its
manifest. Each engine member is one request whose params are the member’s arguments as JSON. Upstream’s engine/protocol/protocol.ts.
Inheritance: object
.NET-only holder name: C# has no free functions.
Fields
Section titled “Fields”EngineProtocolVersion
Section titled “EngineProtocolVersion”public const int EngineProtocolVersion = 1The protocol version this runner speaks; initialize refuses any other. Upstream’s ENGINE_PROTOCOL_VERSION.
Value: int
ErrnoKey
Section titled “ErrnoKey”public const string ErrnoKey = "e2e.errno"The Data key a plain error keeps its own error code under, such as ECONNREFUSED, on both sides of the
protocol. Upstream carries a Node error’s code as errno. .NET-only: a .NET exception has no such property.
Value: string
RemoteStackKey
Section titled “RemoteStackKey”public const string RemoteStackKey = "e2e.remoteStack"The Data key a decoded error keeps the stack it crossed with under. .NET-only: a .NET stack trace is read-only.
Value: string
Properties
Section titled “Properties”EngineMethods
Section titled “EngineMethods”public static IReadOnlyList<string> EngineMethods { get; }Every engine method a server may answer, in protocol order. Upstream’s ENGINE_METHODS.
Value: IReadOnlyList<string>
Methods
Section titled “Methods”public static IReadOnlyDictionary<string, ProtocolMethod> Methods { get; }Every engine method a server may answer, one per engine member: the one table the manifest, the client, and the server are all read
off. Upstream’s METHODS, in protocol order.
Value: IReadOnlyDictionary<string, ProtocolMethod>
ServedMethods
Section titled “ServedMethods”public static IReadOnlySet<string> ServedMethods { get; }Methods serveEngine answers for any engine: it tracks the attempt whether or not the engine has hooks for it. Upstream’s SERVED_METHODS.
Value: IReadOnlySet<string>
Methods
Section titled “Methods”DecodeError(RpcErrorObject, int)
Section titled “DecodeError(RpcErrorObject, int)”public static Exception DecodeError(RpcErrorObject error, int depth = 0)Decodes an error response into the error the engine member threw, with the causes it crossed with. Upstream’s decodeError.
Parameters
| Name | Type | Description |
|---|---|---|
error |
RpcErrorObject | |
depth |
int |
Returns: Exception
DecodeLocatorAction(object)
Section titled “DecodeLocatorAction(object)”public static LocatorAction DecodeLocatorAction(object action)Restores file payload bytes at the engine protocol boundary. Upstream’s decodeLocatorAction.
Parameters
| Name | Type | Description |
|---|---|---|
action |
object |
Returns: LocatorAction
DecodeSnapshot(WireSnapshot)
Section titled “DecodeSnapshot(WireSnapshot)”public static EngineSnapshot DecodeSnapshot(WireSnapshot wire)Decodes a snapshot off the wire. Upstream’s decodeSnapshot.
Parameters
| Name | Type | Description |
|---|---|---|
wire |
WireSnapshot |
Returns: EngineSnapshot
EncodeAbortReason(Exception?)
Section titled “EncodeAbortReason(Exception?)”public static RpcErrorObject? EncodeAbortReason(Exception? reason)Encodes an abort reason, or null for the platform’s own cancellation, which the receiving side reproduces by aborting without a
reason. Upstream’s encodeAbortReason, whose platform error is AbortError.
Parameters
| Name | Type | Description |
|---|---|---|
reason |
Exception |
Returns: RpcErrorObject
EncodeError(Exception, int)
Section titled “EncodeError(Exception, int)”public static RpcErrorObject EncodeError(Exception cause, int depth = 0)Encodes what an engine member threw. An EngineException and a harness error keep their code and category, so the
harness classifies a remote failure exactly as a local one; anything else crosses as its message, which the harness treats as an
infrastructure failure, as it does locally. Every error keeps its stack and its first causes. Upstream’s encodeError.
Parameters
| Name | Type | Description |
|---|---|---|
cause |
Exception | |
depth |
int |
Returns: RpcErrorObject
EncodeLocatorAction(LocatorAction)
Section titled “EncodeLocatorAction(LocatorAction)”public static object EncodeLocatorAction(LocatorAction action)Encodes file payload bytes without changing other locator actions. Returns a WireSetInputFilePayloads for
LocatorAction.SetInputFilePayloads and the same action instance for any other kind: upstream’s
WireLocatorAction is a union of the two.
Parameters
| Name | Type | Description |
|---|---|---|
action |
LocatorAction |
Returns: object
EncodeSnapshot(EngineSnapshot)
Section titled “EncodeSnapshot(EngineSnapshot)”public static WireSnapshot EncodeSnapshot(EngineSnapshot snapshot)Encodes a snapshot for the wire. Upstream’s encodeSnapshot.
Parameters
| Name | Type | Description |
|---|---|---|
snapshot |
EngineSnapshot |
Returns: WireSnapshot
EngineMember(EngineHandle, string)
Section titled “EngineMember(EngineHandle, string)”public static Delegate? EngineMember(EngineHandle engine, string member)An engine member’s function, read off a member path of Methods; null when the engine lacks it. Upstream’s
engineMember.
Parameters
| Name | Type | Description |
|---|---|---|
engine |
EngineHandle | |
member |
string |
Returns: Delegate