Files

11 lines
8.0 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Make (capnp-rpc.Capnp_rpc_proto.CapTP.Make)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../../index.html">capnp-rpc</a> &#x00BB; <a href="../../index.html">Capnp_rpc_proto</a> &#x00BB; <a href="../index.html">CapTP</a> &#x00BB; Make</nav><header class="odoc-preamble"><h1>Module <code><span>CapTP.Make</span></code></h1></header><nav class="odoc-toc"><ul><li><a href="#parameters">Parameters</a></li><li><a href="#signature">Signature</a><ul><li><a href="#debugging-and-diagnostics">Debugging and diagnostics</a></li></ul></li></ul></nav><div class="odoc-content"><h2 id="parameters"><a href="#parameters" class="anchor"></a>Parameters</h2><div class="odoc-spec"><div class="spec parameter anchored" id="argument-1-EP"><a href="#argument-1-EP" class="anchor"></a><code><span><span class="keyword">module</span> </span><span><a href="argument-1-EP/index.html">EP</a></span><span> : <a href="../../Message_types/module-type-ENDPOINT/index.html">Message_types.ENDPOINT</a></span></code></div></div><h2 id="signature"><a href="#signature" class="anchor"></a>Signature</h2><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div><div class="spec-doc"><p>A <code>t</code> is a connection to a remote vat.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-restorer"><a href="#type-restorer" class="anchor"></a><code><span><span class="keyword">type</span> restorer</span><span> =
<span><span>(<span><span><span>(<a href="argument-1-EP/Core_types/class-type-cap/index.html">EP.Core_types.cap</a>, <a href="../../Exception/index.html#type-t">Exception.t</a>)</span> <span class="xref-unresolved">Stdlib</span>.result</span> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span>
<span>string <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p>A <code>restorer</code> is a function <code>f</code> for restoring saved capabilities. <code>f k object_id</code> must eventually call <code>k result</code> exactly once to respond to the client's bootstrap message with <code>result</code>. <code>k</code> takes ownership of the capability.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-create"><a href="#val-create" class="anchor"></a><code><span><span class="keyword">val</span> create :
<span><span class="optlabel">?restore</span>:<a href="#type-restorer">restorer</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">tags</span>:<span class="xref-unresolved">Logs</span>.Tag.set <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">fork</span>:<span>(<span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">queue_send</span>:<span>(<span><span>[&gt; <a href="argument-1-EP/Out/index.html#type-t">EP.Out.t</a> ]</span> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span>
<a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>create ~restore ~tags ~fork ~queue_send</code> is a handler for a connection to a remote peer. Messages will be sent to the peer by calling <code>queue_send</code> (which MUST deliver them in order). If the remote peer asks for a bootstrap object, <code>restore</code> will be used to get it. Log messages will be tagged with <code>tags</code>.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">fork</span> <p>is used when dispatching a local method handler.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-bootstrap"><a href="#val-bootstrap" class="anchor"></a><code><span><span class="keyword">val</span> bootstrap : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <a href="argument-1-EP/Core_types/class-type-cap/index.html">EP.Core_types.cap</a></span></code></div><div class="spec-doc"><p><code>bootstrap t object_id</code> returns a reference to the remote peer's bootstrap object, if any. <code>object_id</code> is the &quot;deprecatedObjectId&quot;, which is, however, still used. This call does not block; the result is a promise for the object, on which further messages may be pipelined.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-handle_msg"><a href="#val-handle_msg" class="anchor"></a><code><span><span class="keyword">val</span> handle_msg : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span>[&lt; <a href="argument-1-EP/In/index.html#type-t">EP.In.t</a> <span><span>| `Unimplemented</span> of <a href="argument-1-EP/Out/index.html#type-t">EP.Out.t</a></span> ]</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>handle_msg t</code> feeds one message received from the remote peer into <code>t</code>. It will call <code>queue_send</code> as necessary to handle the call. Messages MUST be fed to <code>handle_msg</code> in the order in which they arrive from the peer.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-disconnect"><a href="#val-disconnect" class="anchor"></a><code><span><span class="keyword">val</span> disconnect : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../Exception/index.html#type-t">Exception.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>disconnect t reason</code> breaks all references with <code>reason</code> and releases the bootstrap object. Does nothing if already disconnected.</p></div></div><h3 id="debugging-and-diagnostics"><a href="#debugging-and-diagnostics" class="anchor"></a>Debugging and diagnostics</h3><div class="odoc-spec"><div class="spec value anchored" id="val-tags"><a href="#val-tags" class="anchor"></a><code><span><span class="keyword">val</span> tags : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Logs</span>.Tag.set</span></code></div><div class="spec-doc"><p><code>tags t</code> is a set of logging tags suitable for logging a message about this connection.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-stats"><a href="#val-stats" class="anchor"></a><code><span><span class="keyword">val</span> stats : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../../Stats/index.html#type-t">Stats.t</a></span></code></div><div class="spec-doc"><p><code>stats t</code> returns statistics about the state of the connection.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-dump"><a href="#val-dump" class="anchor"></a><code><span><span class="keyword">val</span> dump : <span><a href="#type-t">t</a> <span class="xref-unresolved">Fmt</span>.t</span></span></code></div><div class="spec-doc"><p><code>dump</code> formats a dump of the current state of the connection.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-check"><a href="#val-check" class="anchor"></a><code><span><span class="keyword">val</span> check : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>check t</code> performs some sanity checks on the state of the tables and raises an exception if it finds a problem.</p></div></div></div></body></html>