package capnp-rpc

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

Extends the core types with types related to networking.

include S.CORE_TYPES
module Wire : S.WIRE

The core RPC logic can be used with different serialisation systems. The appropriate types should be provided here.

type 'a or_error = ('a, Error.t) result
class type base_ref = object ... end

Common methods for struct_ref and cap.

val pp : base_ref Fmt.t
val inc_ref : base_ref -> unit

inc_ref x increases x's ref-count by one.

val dec_ref : base_ref -> unit

dec_ref x decreases x's ref-count by one.

class type struct_ref = object ... end

The result of a call, which may not have arrived yet. It can be used to pipeline calls to capabilities that we hope will be returned in the results.

class type cap = object ... end

A capability reference to an object that can handle calls. We might not yet know its final location, but we may be able to pipeline messages to it anyway.

class type struct_resolver = object ... end

A struct_resolver can be used to resolve some promise.

module Attachments : sig ... end
module Request_payload : S.PAYLOAD with type t = Wire.Request.t and type cap := cap and type path := Wire.Path.t

The payload of a request message.

module Response_payload : S.PAYLOAD with type t = Wire.Response.t and type cap := cap and type path := Wire.Path.t

The payload of a response message.

class virtual ref_counted : object ... end

A mix-in to help with writing reference-counted objects. It will call self#release when the ref-count reaches zero.

class virtual service : object ... end

A convenience base class for creating local services. The capability is always resolved, and the default release method does nothing.

val null : cap

A (broken) capability representing a missing pointer. Any attempt to call it will return an error.

return x is a resolved struct_ref with successful resolution x.

val fail : ?ty:Exception.ty -> ('a, Format.formatter, unit, struct_ref) format4 -> 'a

fail fmt is a struct_ref that is broken with the given capnp exception message.

val broken_cap : Exception.t -> cap

broken_cap ex is a cap that is broken with the given exception.

val broken_struct : Error.t -> struct_ref

broken_struct err is a struct_ref that is broken with the given error.

resolved x is a resolved struct_ref with resolution x.

val resolve_payload : struct_resolver -> Response_payload.t or_error -> unit

resolve_payload r x is r#resolve (resolved x). r takes ownership of x.

val resolve_ok : struct_resolver -> Wire.Response.t -> unit

resolve_ok r msg is resolve_payload r (Ok msg). r takes ownership of msg.

val resolve_exn : struct_resolver -> Exception.t -> unit

resolve_exn r exn is resolve_payload r (Error (`Exception exn)).

type sturdy_ref
type provision_id
type recipient_id
type third_party_cap_id
type join_key_part