Files

13 lines
7.2 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>Sturdy_ref (capnp-rpc.Capnp_rpc.Sturdy_ref)</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</a> &#x00BB; Sturdy_ref</nav><header class="odoc-preamble"><h1>Module <code><span>Capnp_rpc.Sturdy_ref</span></code></h1></header><div class="odoc-content"><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> <span>+'a t</span></span></code></div><div class="spec-doc"><p>An off-line (persistent) capability reference.</p><p>A sturdy ref contains all the information necessary to get a live reference to a service:</p><ul><li>The network address of the hosting vat (e.g. TCP host and port)</li><li>A way to authenticate the hosting vat (e.g. a fingerprint of the vat's public key)</li><li>A way to identify the target service within the vat and prove permission to access it (e.g. a &quot;Swiss number&quot;)</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect"><a href="#val-connect" class="anchor"></a><code><span><span class="keyword">val</span> connect : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><span class="type-var">'a</span> <a href="../Capability/index.html#type-t">Capability.t</a></span>, <a href="../../Capnp_rpc_proto/Exception/index.html#type-t">Exception.t</a>)</span> <span class="xref-unresolved">Stdlib</span>.result</span></span></code></div><div class="spec-doc"><p><code>connect t</code> returns a live reference to <code>t</code>'s service.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-connect_exn"><a href="#val-connect_exn" class="anchor"></a><code><span><span class="keyword">val</span> connect_exn : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <a href="../Capability/index.html#type-t">Capability.t</a></span></span></code></div><div class="spec-doc"><p><code>connect_exn</code> is a wrapper for <code>connect</code> that raises an exception on error.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_cap"><a href="#val-with_cap" class="anchor"></a><code><span><span class="keyword">val</span> with_cap :
<span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span><span><span class="type-var">'a</span> <a href="../Capability/index.html#type-t">Capability.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span class="type-var">'b</span>, <span>[&gt; <span>`Capnp of <a href="../../Capnp_rpc_proto/Exception/index.html#type-t">Exception.t</a></span> ]</span> <span class="keyword">as</span> 'e)</span> <span class="xref-unresolved">Stdlib</span>.result</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="type-var">'b</span>, <span class="type-var">'e</span>)</span> <span class="xref-unresolved">Stdlib</span>.result</span></span></code></div><div class="spec-doc"><p><code>with_cap t f</code> uses <code>connect t</code> to get a live-ref <code>x</code>, then does <code>Capability.with_ref x f</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_cap_exn"><a href="#val-with_cap_exn" class="anchor"></a><code><span><span class="keyword">val</span> with_cap_exn : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span><span><span class="type-var">'a</span> <a href="../Capability/index.html#type-t">Capability.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span>)</span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'b</span></span></code></div><div class="spec-doc"><p><code>with_cap_exn t f</code> uses <code>connect_exn t</code> to get a live-ref <code>x</code>, then does <code>Capability.with_ref x f</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-reader"><a href="#val-reader" class="anchor"></a><code><span><span class="keyword">val</span> reader :
<span><span>(<span><span><span class="type-var">'a</span> <a href="../StructStorage/index.html#type-reader_t">StructStorage.reader_t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="xref-unresolved">Capnp</span>.MessageSig.ro <a href="../Slice/index.html#type-t">Slice.t</a></span> option</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">'a</span> <a href="../StructStorage/index.html#type-reader_t">StructStorage.reader_t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Uri</span>.t</span></code></div><div class="spec-doc"><p><code>reader accessor</code> is a field accessor for reading a sturdy ref. e.g. if <code>sr_get</code> is a generated field accessor for an AnyPointer field, then <code>reader Reader.Struct.sr_get</code> is an accessor that treats it as a SturdyRef field. todo: This should really return a sturdy ref, not a URI, but that requires a change to the spec to add a sturdy ref cap-descriptor table entry type.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-builder"><a href="#val-builder" class="anchor"></a><code><span><span class="keyword">val</span> builder :
<span><span>(<span><span><span class="type-var">'a</span> <a href="../StructStorage/index.html#type-builder_t">StructStorage.builder_t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="xref-unresolved">Capnp</span>.MessageSig.rw <a href="../Slice/index.html#type-t">Slice.t</a></span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">'a</span> <a href="../StructStorage/index.html#type-builder_t">StructStorage.builder_t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">_</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p><code>builder setter</code> converts a generated AnyPointer field setter <code>setter</code> to a SturdyRef setter. Use it to add a SturdyRef to a message with <code>builder Params.sr_get params sr</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-cast"><a href="#val-cast" class="anchor"></a><code><span><span class="keyword">val</span> cast : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'b</span> <a href="#type-t">t</a></span></span></code></div></div></div></body></html>