Logo Xantham

TscMailbox Type

Asynchronous wrapper for the serial channel. Avoids the async-api overhead of the tsc encoding.

If there is a backlog of requests after the first, then the mailbox will batch them together.

Lone callers never batch, and costs nothing extra. The synchronous api is generated to avoid unwrapping async replies in small PoCs.

The mailbox, under pressure, outperforms serial usage by a factor of 2.1-2.3 times.

Constructors

Constructor Description

TscMailbox(exePath, cwd, ?callbacks)

Full Usage: TscMailbox(exePath, cwd, ?callbacks)

Parameters:
Returns: TscMailbox
exePath : string
cwd : string
?callbacks : IDictionary<string, TsGoCallback>
Returns: TscMailbox

Instance members

Instance member Description

this.Dispose

Full Usage: this.Dispose

Stops the agent and closes the channel, which is owned here: the channel is constructed internally and never handed out, so no caller can be holding it. Idempotent, because `use` will call this again after an explicit call.

this.Request

Full Usage: this.Request

Parameters:
    method : string
    parameters : 'Params

Returns: Async<'Result>
Type parameters: 'Params, 'Result

A request whose result the schema says is always present.

method : string
parameters : 'Params
Returns: Async<'Result>

this.RequestAst

Full Usage: this.RequestAst

Parameters:
    method : string
    parameters : 'Params

Returns: Async<SourceFile voption>
Type parameters: 'Params

One of the four AST-returning methods. The blob is decoded here rather than handed back as bytes, matching `ProtoJson.requestAst`. The agent has already normalised the two encodings the transport uses for it, so this sees raw bytes regardless of whether the request travelled alone or in a batch.

method : string
parameters : 'Params
Returns: Async<SourceFile voption>

this.RequestNoParams

Full Usage: this.RequestNoParams

Parameters:
    method : string

Returns: Async<'Result>
Type parameters: 'Result

A parameterless request whose result the schema says is always present.

method : string
Returns: Async<'Result>

this.RequestNoParamsOption

Full Usage: this.RequestNoParamsOption

Parameters:
    method : string

Returns: Async<'Result voption>
Type parameters: 'Result

A parameterless request whose result the schema permits to be null.

method : string
Returns: Async<'Result voption>

this.RequestOption

Full Usage: this.RequestOption

Parameters:
    method : string
    parameters : 'Params

Returns: Async<'Result voption>
Type parameters: 'Params, 'Result

A request whose result the schema permits to be null.

method : string
parameters : 'Params
Returns: Async<'Result voption>

this.RequestUnit

Full Usage: this.RequestUnit

Parameters:
    method : string
    parameters : 'Params

Returns: Async<unit>
Type parameters: 'Params

A request that returns nothing. The reply is still awaited: the point of the round trip is to know the server got there, and a failure has to surface somewhere.

method : string
parameters : 'Params
Returns: Async<unit>

this.RequestUnitNoParams

Full Usage: this.RequestUnitNoParams

Parameters:
    method : string

Returns: Async<unit>

A parameterless request that returns nothing.

method : string
Returns: Async<unit>

Type something to start searching.