Module Restorer.Table

type t

A restorer that keeps a hashtable mapping IDs to capabilities in memory.

val create : (Id.t -> Uri.t) -> t

create make_sturdy is a new in-memory-only table. make_sturdy id converts an ID to a full URI, by adding the hosting vat's address and fingerprint.

val of_loader : sw:Eio.Switch.t -> (module LOADER with type t = 'loader) -> 'loader -> t

of_loader ~sw (module Loader) l is a new caching table that uses Loader.load l sr (Loader.hash id) to restore services that aren't in the cache. The load function runs in a new fiber in sw.

val add : t -> Id.t -> 'a Capnp_rpc.Std.Capability.t -> unit

add t id cap adds a mapping to t. It takes ownership of cap (it will call Capability.dec_ref cap on clear).

val sturdy_ref : t -> Id.t -> 'a Capnp_rpc.Std.Sturdy_ref.t

sturdy_ref t id is a sturdy ref that can be used to restore service id.

val remove : t -> Id.t -> unit

remove t id removes id from t. It decrements the capability's ref count if it was added manually with add.

val clear : t -> unit

clear t removes all entries from the table.