package capnp-rpc-net
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Cap'n Proto is a capability-based RPC system with bindings for many languages
Install
dune-project
Dependency
Authors
Maintainers
Sources
capnp-rpc-2.1.1.tbz
sha256=6e9675034c8eac5873ed511f9b968db5223278145bb02ac4a970053a53970a48
sha512=2e2eb8389071bdad3ceef1d15200bf28987f13319f754f4d1603828d0d79202b4de90a6eb294f12ee088c7e3b73755286fbe7076b8fd3d0b29644221e0e7e080
doc/src/capnp-rpc-net/s.ml.html
Source file s.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146(** Module signatures. *) module type ADDRESS = sig type t (** A network address at which a vat can be reached. *) val parse_uri : Uri.t -> ((t * string), [> `Msg of string]) result (** [parse_uri uri] extracts from a URI the network address and service ID. *) val to_uri : t * string -> Uri.t (** [to_uri (t, service_id)] is a URI that can be parsed back into [(t, service_id)] by [parse_uri]. *) val equal : t -> t -> bool val digest : t -> Auth.Digest.t (** How to verify that the correct address has been reached. *) val pp : t Fmt.t end module type NETWORK = sig module Types : Capnp_rpc_proto.S.NETWORK_TYPES module Address : ADDRESS type t val connect : t -> sw:Eio.Switch.t -> secret_key:Auth.Secret_key.t Lazy.t -> Address.t -> (Endpoint.t, [> `Msg of string]) result (** [connect t ~sw ~secret_key address] connects to [address], proves ownership of [secret_key] (if TLS is being used), and returns the resulting endpoint. Returns an error if no connection can be established or the target fails to authenticate itself. *) val parse_third_party_cap_id : Capnp_rpc.Private.Schema.Reader.pointer_t -> Types.third_party_cap_id end module type VAT_NETWORK = sig (** Stretching capability references across a network link. Note: see {!module:Capnp_rpc_unix} for a higher-level wrapper for this API. *) type +'a capability (** An ['a capability] is a capability reference to a service of type ['a]. *) type restorer (** A function for restoring persistent capabilities from sturdy ref service IDs. *) type +'a sturdy_ref (** An off-line (persistent) capability. *) type service_id (** A (secret) token that identifies a persistent service within a vat and grants access to it. *) module Network : NETWORK (** Sharing capabilities over a network link. *) module CapTP : sig type t (** A CapTP connection to a remote peer. *) val connect : sw:Eio.Switch.t -> restore:restorer -> ?tags:Logs.Tag.set -> Endpoint.t -> t (** [connect ~sw ~restore ~switch endpoint] is fresh CapTP protocol handler that sends and receives messages using [endpoint]. [restore] is used to respond to "Bootstrap" messages. If the connection fails then [endpoint] will be disconnected. You must call {!run} to run the loop handling messages. @param sw Used to run methods and to run the transmit thread. *) val run : t -> unit (** [run t] reads and handles incoming messages until the connection is finished. *) val bootstrap : t -> service_id -> 'a capability (** [bootstrap t object_id] is the peer's bootstrap object [object_id], if any. Use [object_id = ""] for the main, public object. *) val disconnect : t -> Capnp_rpc.Exception.t -> unit (** [disconnect reason] closes the connection, sending [reason] to the peer to explain why. Capabilities and questions at both ends will break, with [reason] as the problem. *) val dump : t Fmt.t (** [dump] dumps the state of the connection, for debugging. *) end (** A Vat is an actor in the CapTP network, composed of objects that can call each other directly. *) module Vat : sig (** An actor in the CapTP network. A Vat may be connected to other Vats over CapTP network connections. Typically an application will create only a single Vat. See the {!module:Capnp_rpc_unix} module for a higher-level API. *) type t (** A local Vat. *) val create : ?tags:Logs.Tag.set -> ?restore:restorer -> ?address:Network.Address.t -> sw:Eio.Switch.t -> secret_key:Auth.Secret_key.t Lazy.t -> Network.t -> t (** [create ~sw ~restore ~address ~secret_key network] is a new Vat that uses [restore] to restore sturdy refs hosted at this vat to live capabilities for peers. The Vat will suggest that other parties connect to it using [address]. Turning off the switch will disconnect any active connections. *) val run_connection : t -> mode:[`Accept|`Connect] -> Endpoint.t -> (CapTP.t -> unit) -> unit (** [run_connection t ~mode endpoint r] runs the protocol over [endpoint], which is a connection to another vat. Once connected, [r conn] is called with the new connection. When [run_connection] returns, [endpoint] can be closed. [mode] is used if two Vats connect to each other at the same time to decide which connection to drop. Use [`Connect] if [t] initiated the new connection. If there is already a connection to [endpoint], [run_connection] may call [r] on that instead and then return. *) val public_address : t -> Network.Address.t option (** [public_address t] is the address that peers should use when connecting to this Vat to locate and authenticate it. *) val sturdy_ref : t -> service_id -> 'a sturdy_ref (** [sturdy_ref t service_id] is a sturdy ref for [service_id], hosted at this Vat. Fails if this Vat does not accept incoming connections. *) val export : t -> 'a sturdy_ref -> Uri.t (** [export t sr] turns [sr] into a URI, which can be displayed and imported into another Vat. *) val sturdy_uri : t -> service_id -> Uri.t (** [sturdy_uri t id] is [sturdy_ref t id |> export t]. *) val import : t -> Uri.t -> ('a sturdy_ref, [> `Msg of string]) result (** [import t uri] parses [uri] as a "capnp://" URI. *) val import_exn : t -> Uri.t -> 'a sturdy_ref (** [import_exn] is a wrapper for [import] that raises an exception if it fails. *) val dump : t Fmt.t end end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>