package octez-libs

  1. Overview
  2. Docs
A package that contains multiple base libraries used by the Octez suite

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/octez-libs.stdlib/Tezos_stdlib/Lwt_dropbox/index.html

Module Tezos_stdlib.Lwt_dropboxSource

A 'dropbox' with a single element.

Sourcetype 'a t

Type of dropbox holding a value of type 'a

Sourceexception Closed

The exception returned when trying to access a 'closed' dropbox.

Sourceval create : unit -> 'a t

Create an empty dropbox.

Sourceval put : 'a t -> 'a -> unit

put t e puts the element e inside the dropbox t. If the dropbox already held an element, the old element is discarded and replaced by the new one.

  • raises Closed

    if close t has been called.

Sourceval take : 'a t -> 'a Lwt.t

take t is a promise that resolves as soon as an element is held by t. The element is removed from t when the promise resolves.

If t already holds an element when take t is called, the promise resolves immediately. Otherwise, the promise resolves when an element is put there.

  • raises Closed

    if close t has been called.

Sourceval take_with_timeout : unit Lwt.t -> 'a t -> 'a option Lwt.t

take_with_timeout timeout t behaves like take t except that it returns None if timeout resolves before an element is put.

Note that timeout is canceled (i.e., fails with Canceled) if an element is put in time (or if one is already present).

  • raises Closed

    if close t has been called.

Sourceval peek : 'a t -> 'a option

peek t is Some e if t holds e and None if t does not hold any element.

  • raises Closed

    if close t has been called.

Sourceval close : 'a t -> unit

close t closes the dropbox t. It terminates all the waiting reader with the exception Closed. All further read or write will also immediately fail with Closed, except if the dropbox is not empty when close is called. In that case, a single (and last) take will succeed.

OCaml

Innovation. Community. Security.