Skip to content

Exposure

[<Class>]
type Exposure =
    new () : Exposure
    member MessageNames: string list
    member Names: string list
    member Nodes: KeyValuePair<string,INode> list
    member Published: IEvent<Publication>
    member Shapes: IReadOnlyDictionary<string,string>
    member Snapshot: Snapshot
    member Dispatch (name: string, args: JsonElement) : Task<Result<Snapshot,string>>
    member MessageShapes (described: (string * string) seq) : unit
    member Messages<'Model, 'Msg> (mvu: Mvu<'Model,'Msg>, decoders: (string * MessageDecoder<'Msg>) seq) : unit
    member Node (name: string, node: INode) : unit
    member Start () : unit
    member Value<'T> (name: string, encode: 'T -> JsonNode, read: unit -> 'T) : unit
    member WaitVersion (version: int64, timeout: TimeSpan) : Task<Snapshot option>
AssemblyRanvier.Mcp
Attributes[<Sealed>]

The graph state an adapter may show: named values registered before Start, published as versioned snapshots.

Start creates one effect, under the current owner, that reads every exposed value. A flush that changes any encoding publishes one snapshot with a version one higher; a re-run whose encodings all equal the previous snapshot's publishes nothing, as does a memo cutoff, which stops the effect re-running at all. A batch produces one publication.

Snapshot is safe to read from any thread and never enters the graph. Registration and Start run on the graph thread. A reader that raises fails the publication effect, and the snapshot keeps its previous value.

Constructors

new () : Exposure

Properties

member MessageNames: string list

The exposed message names, in registration order.

member Names: string list

The exposed value names, in registration order.

member Nodes: KeyValuePair<string,INode> list

The nodes a provenance tool's node argument can name, in registration order.

member Published: IEvent<Publication>

Raised on the graph thread, inside the publishing flush, after Snapshot holds the new snapshot.

member Shapes: IReadOnlyDictionary<string,string>

The one-line argument description of each described message.

member Snapshot: Snapshot

The latest published snapshot. Readable from any thread.

Methods

member Dispatch (name: string, args: JsonElement) : Task<Result<Snapshot,string>>

Decodes args with the decoder exposed under name and dispatches the message, on the graph thread. The task holds the snapshot published once the dispatch and its effects have run, or the reason the message was rejected. A rejected message dispatches nothing. Callable from any thread after Start.

A decoder that raises rejects the message. The task faults when update raises, and with ObjectDisposedException once the graph is disposed.

Raises
System.InvalidOperationExceptionCalled before Start.
member MessageShapes (described: (string * string) seq) : unit

Describes each named message's arguments in one line, such as {"sku": string, "quantity": int ≥ 1}. The adapter shows the line in dispatch's description and in the message's malformed-argument errors.

Raises
System.InvalidOperationExceptionCalled after Start.
member Messages<'Model, 'Msg> (mvu: Mvu<'Model,'Msg>, decoders: (string * MessageDecoder<'Msg>) seq) : unit

Authorises each decoder's message for Dispatch under its name: a dispatch decodes the arguments and, on Ok, dispatches the message to mvu.

Raises
System.InvalidOperationExceptionCalled after Start.
System.ArgumentExceptionA message name is taken, or holds a character outside [A-Za-z0-9_.~-].
member Node (name: string, node: INode) : unit

Names node as name for the node argument of a traced build's provenance tools. The registration is a name, not an access limit: the traced tools read the whole graph's trace log. An untraced build serves no provenance tools, and the registration has no effect there.

Raises
System.InvalidOperationExceptionCalled after Start.
System.ArgumentExceptionThe node name is taken, or holds a character outside [A-Za-z0-9_.~-].
member Start () : unit

Closes registration and creates the publication effect under the current owner of the ambient graph, which publishes the first snapshot.

Raises
System.InvalidOperationExceptionCalled twice, or with no ambient graph.
member Value<'T> (name: string, encode: 'T -> JsonNode, read: unit -> 'T) : unit

Exposes read's value under name, encoded by encode.

Raises
System.InvalidOperationExceptionCalled after Start.
System.ArgumentExceptionThe name is taken, or holds a character outside [A-Za-z0-9_.~-].
member WaitVersion (version: int64, timeout: TimeSpan) : Task<Snapshot option>

A task holding the first published snapshot whose version is at least version, or None once timeout elapses first. Callable from any thread; it does not enter the graph.