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>| Assembly | Ranvier.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 () : ExposureProperties
member Nodes: KeyValuePair<string,INode> list
member Nodes: KeyValuePair<string,INode> listThe nodes a provenance tool's node argument can name, in registration order.
member Published: IEvent<Publication>
member Published: IEvent<Publication>Raised on the graph thread, inside the publishing flush, after Snapshot holds the new snapshot.
member Shapes: IReadOnlyDictionary<string,string>
member Shapes: IReadOnlyDictionary<string,string>The one-line argument description of each described message.
member Snapshot: Snapshot
member Snapshot: SnapshotThe latest published snapshot. Readable from any thread.
Methods
member Dispatch (name: string, args: JsonElement) : Task<Result<Snapshot,string>>
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.InvalidOperationException | Called before Start. |
member MessageShapes (described: (string * string) seq) : unit
member MessageShapes (described: (string * string) seq) : unitDescribes 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.InvalidOperationException | Called after Start. |
member Messages<'Model, 'Msg> (mvu: Mvu<'Model,'Msg>, decoders: (string * MessageDecoder<'Msg>) seq) : unit
member Messages<'Model, 'Msg> (mvu: Mvu<'Model,'Msg>, decoders: (string * MessageDecoder<'Msg>) seq) : unitAuthorises each decoder's message for Dispatch under its name: a dispatch decodes the arguments and, on Ok, dispatches the message to mvu.
| Raises | |
|---|---|
System.InvalidOperationException | Called after Start. |
System.ArgumentException | A message name is taken, or holds a character outside [A-Za-z0-9_.~-]. |
member Node (name: string, node: INode) : unit
member Node (name: string, node: INode) : unitNames 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.InvalidOperationException | Called after Start. |
System.ArgumentException | The node name is taken, or holds a character outside [A-Za-z0-9_.~-]. |
member Start () : unit
member Start () : unitCloses registration and creates the publication effect under the current owner of the ambient graph, which publishes the first snapshot.
| Raises | |
|---|---|
System.InvalidOperationException | Called twice, or with no ambient graph. |
member Value<'T> (name: string, encode: 'T -> JsonNode, read: unit -> 'T) : unit
member Value<'T> (name: string, encode: 'T -> JsonNode, read: unit -> 'T) : unitExposes read's value under name, encoded by encode.
| Raises | |
|---|---|
System.InvalidOperationException | Called after Start. |
System.ArgumentException | The name is taken, or holds a character outside [A-Za-z0-9_.~-]. |
member WaitVersion (version: int64, timeout: TimeSpan) : Task<Snapshot option>
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.