package kcas_data

  1. Overview
  2. Docs

Explicit transaction log passing on promises.

val resolve : xt:'x Kcas.Xt.t -> 'a u -> 'a -> unit

resolve u v resolves to promise corresponding to the resolver u to the value v. Any awaiters of the corresponding promise are then unblocked.

val await : xt:'x Kcas.Xt.t -> 'a t -> 'a

await t either immediately returns the resolved value of the promise t or blocks until the promise t is resolved.

val peek : xt:'x Kcas.Xt.t -> 'a t -> 'a option

peek t immediately returns either the resolved value of the promise t or None in case the promise hasn't yet been resolved.

val is_resolved : xt:'x Kcas.Xt.t -> 'a t -> bool

is_resolved t determines whether the promise t has already been resolved.

Result promises

val await_exn : xt:'x Kcas.Xt.t -> 'a or_exn -> 'a

await_exn t is equivalent to match await t with v -> v | exception e -> raise e.

val resolve_ok : xt:'x Kcas.Xt.t -> ('a, 'b) result u -> 'a -> unit

resolve_ok u v is equivalent to resolve u (Ok v).

val resolve_error : xt:'x Kcas.Xt.t -> ('a, 'b) result u -> 'b -> unit

resolve_error u e is equivalent to resolve u (Error e).

OCaml

Innovation. Community. Security.