package capnp-rpc

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Capnp_rpc.Sturdy_refSource

Sourcetype +'a t

An off-line (persistent) capability reference.

A sturdy ref contains all the information necessary to get a live reference to a service:

  • The network address of the hosting vat (e.g. TCP host and port)
  • A way to authenticate the hosting vat (e.g. a fingerprint of the vat's public key)
  • A way to identify the target service within the vat and prove permission to access it (e.g. a "Swiss number")
Sourceval connect : 'a t -> ('a Capability.t, Exception.t) result

connect t returns a live reference to t's service.

Sourceval connect_exn : 'a t -> 'a Capability.t

connect_exn is a wrapper for connect that raises an exception on error.

Sourceval with_cap : 'a t -> ('a Capability.t -> ('b, [> `Capnp of Exception.t ] as 'e) result) -> ('b, 'e) result

with_cap t f uses connect t to get a live-ref x, then does Capability.with_ref x f.

Sourceval with_cap_exn : 'a t -> ('a Capability.t -> 'b) -> 'b

with_cap_exn t f uses connect_exn t to get a live-ref x, then does Capability.with_ref x f.

reader accessor is a field accessor for reading a sturdy ref. e.g. if sr_get is a generated field accessor for an AnyPointer field, then reader Reader.Struct.sr_get 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.

builder setter converts a generated AnyPointer field setter setter to a SturdyRef setter. Use it to add a SturdyRef to a message with builder Params.sr_get params sr.

Sourceval cast : 'a t -> 'b t