diff --git a/hmap/Hmap/Key/index.html b/hmap/Hmap/Key/index.html new file mode 100644 index 00000000..6459383a --- /dev/null +++ b/hmap/Hmap/Key/index.html @@ -0,0 +1,2 @@ + +Key (hmap.Hmap.Key)

Module Hmap.Key

Keys.

Keys

val create : unit -> 'a key

create () is a new key.

Existential keys

Exisential keys allows to compare keys. This can be useful for functions like filter.

type t

The type for existential keys.

val hide_type : 'a key -> t

hide_type k is an existential key for k.

val equal : t -> t -> bool

equal k k' is true iff k and k' are the same key.

val compare : t -> t -> int

compare k k' is a total order on keys compatible with equal.

diff --git a/hmap/Hmap/Make/Key/index.html b/hmap/Hmap/Make/Key/index.html new file mode 100644 index 00000000..6c1733be --- /dev/null +++ b/hmap/Hmap/Make/Key/index.html @@ -0,0 +1,2 @@ + +Key (hmap.Hmap.Make.Key)

Module Make.Key

Keys.

Keys

type 'a info = 'a Key_info.t

The type for key information.

val create : 'a info -> 'a key

create i is a new key with information i.

val info : 'a key -> 'a info

info k is k's information.

Existential keys

Exisential keys allow to compare keys. This can be useful for functions like filter.

type t

The type for existential keys.

val hide_type : 'a key -> t

hide_type k is an existential key for k.

val equal : t -> t -> bool

equal k k' is true iff k and k' are the same key.

val compare : t -> t -> int

compare k k' is a total order on keys compatible with equal.

diff --git a/hmap/Hmap/Make/argument-1-Key_info/index.html b/hmap/Hmap/Make/argument-1-Key_info/index.html new file mode 100644 index 00000000..dbf00dad --- /dev/null +++ b/hmap/Hmap/Make/argument-1-Key_info/index.html @@ -0,0 +1,2 @@ + +Key_info (hmap.Hmap.Make.Key_info)

Parameter Make.Key_info

type 'a t

The type for key information.

diff --git a/hmap/Hmap/Make/index.html b/hmap/Hmap/Make/index.html new file mode 100644 index 00000000..91594c35 --- /dev/null +++ b/hmap/Hmap/Make/index.html @@ -0,0 +1,2 @@ + +Make (hmap.Hmap.Make)

Module Hmap.Make

Functor for heterogeneous maps whose keys hold information of type Key_info.t

Parameters

Signature

Keys

type 'a key

The type for keys whose lookup value is of type 'a.

module Key : sig ... end

Keys.

Maps

type t

The type for heterogeneous value maps.

val empty : t

empty is the empty map.

val is_empty : t -> bool

is_empty m is true iff m is empty.

val mem : 'a key -> t -> bool

mem k m is true iff k is bound in m.

val add : 'a key -> 'a -> t -> t

add k v m is m with k bound to v.

val singleton : 'a key -> 'a -> t

singleton k v is add k v empty.

val rem : 'a key -> t -> t

rem k m is m with k unbound.

val find : 'a key -> t -> 'a option

find k m is the value of k's binding in m, if any.

val get : 'a key -> t -> 'a

get k m is the value of k's binding in m.

  • raises Invalid_argument

    if k is not bound in m.

type binding =
  1. | B : 'a key * 'a -> binding

The type for bindings.

val iter : (binding -> unit) -> t -> unit

iter f m applies f to all bindings of m.

val fold : (binding -> 'a -> 'a) -> t -> 'a -> 'a

fold f m acc folds over the bindings of m with f, starting with acc

val for_all : (binding -> bool) -> t -> bool

for_all p m is true iff all bindings of m satisfy p.

val exists : (binding -> bool) -> t -> bool

exists p m is true iff there exists a bindings of m that satisfies p.

val filter : (binding -> bool) -> t -> t

filter p m are the bindings of m that satisfy p.

val cardinal : t -> int

cardinal m is the number of bindings in m.

val any_binding : t -> binding option

any_binding m is a binding of m (if not empty).

val get_any_binding : t -> binding

get_any_binding m is a binding of m.

  • raises Invalid_argument

    if m is empty.

diff --git a/hmap/Hmap/index.html b/hmap/Hmap/index.html new file mode 100644 index 00000000..989bc575 --- /dev/null +++ b/hmap/Hmap/index.html @@ -0,0 +1,2 @@ + +Hmap (hmap.Hmap)

Module Hmap

Heterogeneous value maps.

v0.8.1 - homepage

Keys

type 'a key

The type for keys whose lookup value is of type 'a.

module Key : sig ... end

Keys.

Maps

type t

The type for heterogeneous value maps.

val empty : t

empty is the empty map.

val is_empty : t -> bool

is_empty m is true iff m is empty.

val mem : 'a key -> t -> bool

mem k m is true iff k is bound in m.

val add : 'a key -> 'a -> t -> t

add k v m is m with k bound to v.

val singleton : 'a key -> 'a -> t

singleton k v is add k v empty.

val rem : 'a key -> t -> t

rem k m is m with k unbound.

val find : 'a key -> t -> 'a option

find k m is the value of k's binding in m, if any.

val get : 'a key -> t -> 'a

get k m is the value of k's binding in m.

  • raises Invalid_argument

    if k is not bound in m.

type binding =
  1. | B : 'a key * 'a -> binding

The type for bindings.

val iter : (binding -> unit) -> t -> unit

iter f m applies f to all bindings of m.

val fold : (binding -> 'a -> 'a) -> t -> 'a -> 'a

fold f m acc folds over the bindings of m with f, starting with acc

val for_all : (binding -> bool) -> t -> bool

for_all p m is true iff all bindings of m satisfy p.

val exists : (binding -> bool) -> t -> bool

exists p m is true iff there exists a bindings of m that satisfies p.

val filter : (binding -> bool) -> t -> t

filter p m are the bindings of m that satisfy p.

val cardinal : t -> int

cardinal m is the number of bindings in m.

val any_binding : t -> binding option

any_binding m is a binding of m (if not empty).

val get_any_binding : t -> binding

get_any_binding m is a binding of m.

  • raises Invalid_argument

    if m is empty.

Functorial interface

The functorial interface allows to associate more information to the keys. For example a key name or a key value pretty-printer.

module type KEY_INFO = sig ... end

The type for key information.

module type S = sig ... end

Output signature of the functor Make

module Make (Key_info : KEY_INFO) : S with type 'a Key.info = 'a Key_info.t

Functor for heterogeneous maps whose keys hold information of type Key_info.t

diff --git a/hmap/Hmap/module-type-KEY_INFO/index.html b/hmap/Hmap/module-type-KEY_INFO/index.html new file mode 100644 index 00000000..ffb6a34c --- /dev/null +++ b/hmap/Hmap/module-type-KEY_INFO/index.html @@ -0,0 +1,2 @@ + +KEY_INFO (hmap.Hmap.KEY_INFO)

Module type Hmap.KEY_INFO

The type for key information.

type 'a t

The type for key information.

diff --git a/hmap/Hmap/module-type-S/Key/index.html b/hmap/Hmap/module-type-S/Key/index.html new file mode 100644 index 00000000..4028d186 --- /dev/null +++ b/hmap/Hmap/module-type-S/Key/index.html @@ -0,0 +1,2 @@ + +Key (hmap.Hmap.S.Key)

Module S.Key

Keys.

Keys

type 'a info

The type for key information.

val create : 'a info -> 'a key

create i is a new key with information i.

val info : 'a key -> 'a info

info k is k's information.

Existential keys

Exisential keys allow to compare keys. This can be useful for functions like filter.

type t

The type for existential keys.

val hide_type : 'a key -> t

hide_type k is an existential key for k.

val equal : t -> t -> bool

equal k k' is true iff k and k' are the same key.

val compare : t -> t -> int

compare k k' is a total order on keys compatible with equal.

diff --git a/hmap/Hmap/module-type-S/index.html b/hmap/Hmap/module-type-S/index.html new file mode 100644 index 00000000..eaf755cd --- /dev/null +++ b/hmap/Hmap/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (hmap.Hmap.S)

Module type Hmap.S

Output signature of the functor Make

Keys

type 'a key

The type for keys whose lookup value is of type 'a.

module Key : sig ... end

Keys.

Maps

type t

The type for heterogeneous value maps.

val empty : t

empty is the empty map.

val is_empty : t -> bool

is_empty m is true iff m is empty.

val mem : 'a key -> t -> bool

mem k m is true iff k is bound in m.

val add : 'a key -> 'a -> t -> t

add k v m is m with k bound to v.

val singleton : 'a key -> 'a -> t

singleton k v is add k v empty.

val rem : 'a key -> t -> t

rem k m is m with k unbound.

val find : 'a key -> t -> 'a option

find k m is the value of k's binding in m, if any.

val get : 'a key -> t -> 'a

get k m is the value of k's binding in m.

  • raises Invalid_argument

    if k is not bound in m.

type binding =
  1. | B : 'a key * 'a -> binding

The type for bindings.

val iter : (binding -> unit) -> t -> unit

iter f m applies f to all bindings of m.

val fold : (binding -> 'a -> 'a) -> t -> 'a -> 'a

fold f m acc folds over the bindings of m with f, starting with acc

val for_all : (binding -> bool) -> t -> bool

for_all p m is true iff all bindings of m satisfy p.

val exists : (binding -> bool) -> t -> bool

exists p m is true iff there exists a bindings of m that satisfies p.

val filter : (binding -> bool) -> t -> t

filter p m are the bindings of m that satisfy p.

val cardinal : t -> int

cardinal m is the number of bindings in m.

val any_binding : t -> binding option

any_binding m is a binding of m (if not empty).

val get_any_binding : t -> binding

get_any_binding m is a binding of m.

  • raises Invalid_argument

    if m is empty.

diff --git a/hmap/_doc-dir/CHANGES.md b/hmap/_doc-dir/CHANGES.md new file mode 100644 index 00000000..ac21d5bc --- /dev/null +++ b/hmap/_doc-dir/CHANGES.md @@ -0,0 +1,9 @@ +v0.8.1 2017-10-03 Zagreb +------------------------ + +* Build depend on topkg. + +v0.8.0 2016-03-08 La Forclaz (VS) +--------------------------------- + +First release. diff --git a/hmap/_doc-dir/LICENSE.md b/hmap/_doc-dir/LICENSE.md new file mode 100644 index 00000000..ca386f07 --- /dev/null +++ b/hmap/_doc-dir/LICENSE.md @@ -0,0 +1,13 @@ + Copyright (c) 2016 Daniel C. Bünzli + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/hmap/_doc-dir/README.md b/hmap/_doc-dir/README.md new file mode 100644 index 00000000..3f4d1cad --- /dev/null +++ b/hmap/_doc-dir/README.md @@ -0,0 +1,43 @@ +Hmap — Heterogeneous value maps for OCaml +------------------------------------------------------------------------------- +v0.8.1 + +Hmap provides heterogeneous value maps for OCaml. These maps bind keys +to values with arbitrary types. Keys witness the type of the value +they are bound to which allows to add and lookup bindings in a type +safe manner. + +Hmap has no dependency and is distributed under the ISC license. + +Home page: http://erratique.ch/software/hmap +Contact: Daniel Bünzli `` + +## Installation + +Hmap can be installed with `opam`: + + opam install hmap + +If you don't use `opam` consult the [`opam`](opam) file for build +instructions. + +## Documentation + +The documentation and API reference is automatically generated by +`ocamldoc` from the interfaces. It can be consulted [online][doc] +and there is a generated version in the `doc` directory of the +distribution. + +[doc]: http://erratique.ch/software/hmap/doc + +## Sample programs + +If you installed Hmap with `opam` sample programs are located in +the directory `opam config var hmap:doc`. + +In the distribution sample programs and tests are located in the +[`test`](test) directory of the distribution. They can be built an run +with + + topkg build --tests true + topkg test diff --git a/hmap/index.html b/hmap/index.html new file mode 100644 index 00000000..c91172d0 --- /dev/null +++ b/hmap/index.html @@ -0,0 +1,2 @@ + +index (hmap.index)

Package hmap

Package info

changes-files
license-files
readme-files
diff --git a/index.html b/index.html index cb33e7af..f7fd7eb6 100644 --- a/index.html +++ b/index.html @@ -1,2 +1,2 @@ -_opam

OCaml package documentation

Browse by name, by tag, the standard library and the OCaml manual (online, latest version).

Generated for /home/runner/work/moonpool/moonpool/_opam/lib

Packages by name

Packages by tag

\ No newline at end of file +_opam

OCaml package documentation

Browse by name, by tag, the standard library and the OCaml manual (online, latest version).

Generated for /home/runner/work/moonpool/moonpool/_opam/lib

Packages by name

Packages by tag

\ No newline at end of file diff --git a/moonpool-lwt/Moonpool_lwt/IO/index.html b/moonpool-lwt/Moonpool_lwt/IO/index.html deleted file mode 100644 index c22b1469..00000000 --- a/moonpool-lwt/Moonpool_lwt/IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -IO (moonpool-lwt.Moonpool_lwt.IO)

Module Moonpool_lwt.IO

IO using the Lwt event loop.

These IO operations work on non-blocking file descriptors and rely on a Lwt_engine event loop being active (meaning, Lwt_main.run is currently running in some thread).

Calling these functions must be done from a moonpool runner. A function like read will first try to perform the IO action directly (here, call Unix.read); if the action fails because the FD is not ready, then await_readable is called: it suspends the fiber and subscribes it to Lwt to be awakened when the FD becomes ready.

val read : Unix.file_descr -> bytes -> int -> int -> int

Read from the file descriptor

val await_readable : Unix.file_descr -> unit

Suspend the fiber until the FD is readable

val write_once : Unix.file_descr -> bytes -> int -> int -> int

Perform one write into the file descriptor

val await_writable : Unix.file_descr -> unit

Suspend the fiber until the FD is writable

val write : Unix.file_descr -> bytes -> int -> int -> unit

Loop around write_once to write the entire slice.

val sleep_s : float -> unit

Suspend the fiber for n seconds.

diff --git a/moonpool-lwt/Moonpool_lwt/IO_in/class-type-t/index.html b/moonpool-lwt/Moonpool_lwt/IO_in/class-type-t/index.html deleted file mode 100644 index 688c0484..00000000 --- a/moonpool-lwt/Moonpool_lwt/IO_in/class-type-t/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -t (moonpool-lwt.Moonpool_lwt.IO_in.t)

Class type IO_in.t

method input : bytes -> int -> int -> int

Read into the slice. Returns 0 only if the stream is closed.

method close : unit -> unit

Close the input. Must be idempotent.

diff --git a/moonpool-lwt/Moonpool_lwt/IO_in/index.html b/moonpool-lwt/Moonpool_lwt/IO_in/index.html deleted file mode 100644 index 3c0c0d11..00000000 --- a/moonpool-lwt/Moonpool_lwt/IO_in/index.html +++ /dev/null @@ -1,6 +0,0 @@ - -IO_in (moonpool-lwt.Moonpool_lwt.IO_in)

Module Moonpool_lwt.IO_in

Input channel

class type t = object ... end
val create : - ?close:(unit -> unit) -> - input:(bytes -> int -> int -> int) -> - unit -> - t
val empty : t
val of_bytes : ?off:int -> ?len:int -> bytes -> t
val of_string : ?off:int -> ?len:int -> string -> t
val input : t -> bytes -> int -> int -> int

Read into the given slice.

  • returns

    the number of bytes read, 0 means end of input.

val close : < close : unit -> unit.. > -> unit

Close the channel.

val really_input : t -> bytes -> int -> int -> unit
val really_input_string : t -> int -> string
val copy_into : ?buf:bytes -> t -> IO_out.t -> unit
val concat : t list -> t
val input_all : ?buf:bytes -> t -> string
val of_unix_fd : ?close_noerr:bool -> ?buf:bytes -> Unix.file_descr -> t
diff --git a/moonpool-lwt/Moonpool_lwt/IO_out/class-type-t/index.html b/moonpool-lwt/Moonpool_lwt/IO_out/class-type-t/index.html deleted file mode 100644 index 0503686a..00000000 --- a/moonpool-lwt/Moonpool_lwt/IO_out/class-type-t/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -t (moonpool-lwt.Moonpool_lwt.IO_out.t)

Class type IO_out.t

method output_char : char -> unit
method output : bytes -> int -> int -> unit
method flush : unit -> unit
method close : unit -> unit
diff --git a/moonpool-lwt/Moonpool_lwt/IO_out/index.html b/moonpool-lwt/Moonpool_lwt/IO_out/index.html deleted file mode 100644 index 5aa168ef..00000000 --- a/moonpool-lwt/Moonpool_lwt/IO_out/index.html +++ /dev/null @@ -1,8 +0,0 @@ - -IO_out (moonpool-lwt.Moonpool_lwt.IO_out)

Module Moonpool_lwt.IO_out

Output channel

class type t = object ... end
val create : - ?flush:(unit -> unit) -> - ?close:(unit -> unit) -> - output_char:(char -> unit) -> - output:(bytes -> int -> int -> unit) -> - unit -> - t
val dummy : t
val of_unix_fd : ?close_noerr:bool -> ?buf:bytes -> Unix.file_descr -> t
val of_buffer : Stdlib.Buffer.t -> t
val output_char : t -> char -> unit

Output the buffer slice into this channel

val output : t -> bytes -> int -> int -> unit

Output the buffer slice into this channel

val output_string : t -> string -> unit
val output_line : t -> string -> unit
val close : < close : unit -> unit.. > -> unit

Close the channel.

val flush : < flush : unit -> unit.. > -> unit

Flush (ie. force write) any buffered bytes.

val output_int : t -> int -> unit
val output_lines : t -> string Stdlib.Seq.t -> unit
val tee : t list -> t
diff --git a/moonpool-lwt/Moonpool_lwt/TCP_client/index.html b/moonpool-lwt/Moonpool_lwt/TCP_client/index.html deleted file mode 100644 index 589fc568..00000000 --- a/moonpool-lwt/Moonpool_lwt/TCP_client/index.html +++ /dev/null @@ -1,5 +0,0 @@ - -TCP_client (moonpool-lwt.Moonpool_lwt.TCP_client)

Module Moonpool_lwt.TCP_client

val with_connect : Unix.sockaddr -> (IO_in.t -> IO_out.t -> 'a) -> 'a

Open a connection, and use IO to read and write from the socket in a non blocking way.

val with_connect_lwt : - Unix.sockaddr -> - (Lwt_io.input_channel -> Lwt_io.output_channel -> 'a) -> - 'a

Open a connection.

diff --git a/moonpool-lwt/Moonpool_lwt/TCP_server/index.html b/moonpool-lwt/Moonpool_lwt/TCP_server/index.html deleted file mode 100644 index 9c31ac51..00000000 --- a/moonpool-lwt/Moonpool_lwt/TCP_server/index.html +++ /dev/null @@ -1,14 +0,0 @@ - -TCP_server (moonpool-lwt.Moonpool_lwt.TCP_server)

Module Moonpool_lwt.TCP_server

type t = Lwt_io.server
val establish_lwt : - ?backlog:int -> - ?no_close:bool -> - runner:Moonpool.Runner.t -> - Unix.sockaddr -> - (Unix.sockaddr -> Lwt_io.input_channel -> Lwt_io.output_channel -> unit) -> - t

establish ~runner addr handler runs a TCP server in the Lwt thread. When a client connects, a moonpool fiber is started on runner to handle it.

val establish : - ?backlog:int -> - ?no_close:bool -> - runner:Moonpool.Runner.t -> - Unix.sockaddr -> - (Unix.sockaddr -> IO_in.t -> IO_out.t -> unit) -> - t

Like establish_lwt but uses IO to directly handle reads and writes on client sockets.

val shutdown : t -> unit

Shutdown the server

diff --git a/moonpool-lwt/Moonpool_lwt/index.html b/moonpool-lwt/Moonpool_lwt/index.html index 98915278..e63481c6 100644 --- a/moonpool-lwt/Moonpool_lwt/index.html +++ b/moonpool-lwt/Moonpool_lwt/index.html @@ -1,2 +1,2 @@ -Moonpool_lwt (moonpool-lwt.Moonpool_lwt)

Module Moonpool_lwt

Lwt_engine-based event loop for Moonpool.

In what follows, we mean by "lwt thread" the thread running Lwt_main.run (so, the thread where the Lwt event loop and all Lwt callbacks execute).

NOTE: this is experimental and might change in future versions.

module Fiber = Moonpool_fib.Fiber
module FLS = Moonpool_fib.Fls

Basic conversions

val fut_of_lwt : 'a Lwt.t -> 'a Moonpool.Fut.t

fut_of_lwt lwt_fut makes a thread-safe moonpool future that completes when lwt_fut does. This must be run from within the Lwt thread.

val lwt_of_fut : 'a Moonpool.Fut.t -> 'a Lwt.t

lwt_of_fut fut makes a lwt future that completes when fut does. This must be called from the Lwt thread, and the result must always be used only from inside the Lwt thread.

Helpers on the moonpool side

val await_lwt : 'a Lwt.t -> 'a

await_lwt fut awaits a Lwt future from inside a task running on a moonpool runner. This must be run from within a Moonpool runner so that the await-ing effect is handled.

val run_in_lwt : (unit -> 'a Lwt.t) -> 'a Moonpool.Fut.t

run_in_lwt f runs f() from within the Lwt thread and returns a thread-safe future. This can be run from anywhere.

val run_in_lwt_and_await : (unit -> 'a Lwt.t) -> 'a

run_in_lwt_and_await f runs f in the Lwt thread, and awaits its result. Must be run from inside a moonpool runner so that the await-in effect is handled.

This is similar to Moonpool.await @@ run_in_lwt f.

val get_runner : unit -> Moonpool.Runner.t

Returns the runner from within which this is called. Must be run from within a fiber.

  • raises Failure

    if not run within a fiber

IO

module IO : sig ... end

IO using the Lwt event loop.

module IO_in : sig ... end

Input channel

module IO_out : sig ... end

Output channel

module TCP_server : sig ... end
module TCP_client : sig ... end

Helpers on the lwt side

val detach_in_runner : runner:Moonpool.Runner.t -> (unit -> 'a) -> 'a Lwt.t

detach_in_runner ~runner f runs f in the given moonpool runner, and returns a lwt future. This must be run from within the thread running Lwt_main.

Wrappers around Lwt_main

val main_with_runner : runner:Moonpool.Runner.t -> (unit -> 'a) -> 'a

main_with_runner ~runner f starts a Lwt-based event loop and runs f() inside a fiber in runner.

val main : (unit -> 'a) -> 'a

Like main_with_runner but with a default choice of runner.

+Moonpool_lwt (moonpool-lwt.Moonpool_lwt)

Module Moonpool_lwt

Lwt_engine-based event loop for Moonpool.

In what follows, we mean by "lwt thread" the thread running Lwt_main.run (so, the thread where the Lwt event loop and all Lwt callbacks execute).

NOTE: this is experimental and might change in future versions.

The API has entirely changed since 0.9 , see https://github.com/c-cube/moonpool/pull/37

module Fut = Moonpool.Fut

Basic conversions

val fut_of_lwt : 'a Lwt.t -> 'a Moonpool.Fut.t

fut_of_lwt lwt_fut makes a thread-safe moonpool future that completes when lwt_fut does. This must be run from within the Lwt thread.

val lwt_of_fut : 'a Moonpool.Fut.t -> 'a Lwt.t

lwt_of_fut fut makes a lwt future that completes when fut does. This must be called from the Lwt thread, and the result must always be used only from inside the Lwt thread.

  • raises Failure

    if not run from the lwt thread.

Helpers on the moonpool side

val spawn_lwt : (unit -> 'a) -> 'a Lwt.t

This spawns a task that runs in the Lwt scheduler.

  • raises Failure

    if lwt_main was not called.

val spawn_lwt_ignore : (unit -> unit) -> unit

Like spawn_lwt but ignores the result, like Lwt.async.

val await_lwt : 'a Lwt.t -> 'a

await_lwt fut awaits a Lwt future from inside a task running on a moonpool runner. This must be run from within a Moonpool runner so that the await-ing effect is handled.

val run_in_lwt_and_await : (unit -> 'a) -> 'a

run_in_lwt_and_await f runs f() in the lwt thread, just like spawn_lwt f, and then calls await_lwt on the result. This means f() can use Lwt functions and libraries, use await_lwt on them freely, etc,

Wrappers around Lwt_main

val on_uncaught_exn : (Moonpool.Exn_bt.t -> unit) ref
val lwt_main : (Moonpool.Runner.t -> 'a) -> 'a

lwt_main f sets the moonpool-lwt bridge up, runs lwt main, calls f, destroys the bridge, and return the result of f().

val on_lwt_thread : unit -> bool

on_lwt_thread () is true if the current thread is the one currently running lwt_main.

  • raises Failure

    if lwt_main was not called.

val lwt_main_runner : unit -> Moonpool.Runner.t

The runner from lwt_main. The runner is only going to work if lwt_main is currently running in some thread.

  • raises Failure

    if lwt_main was not called.

val is_setup : unit -> bool

Is the moonpool-lwt bridge setup?

diff --git a/moonpool-lwt/Moonpool_lwt__/index.html b/moonpool-lwt/Moonpool_lwt__/index.html deleted file mode 100644 index e0ad15ce..00000000 --- a/moonpool-lwt/Moonpool_lwt__/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Moonpool_lwt__ (moonpool-lwt.Moonpool_lwt__)

Module Moonpool_lwt__

This module is hidden.

diff --git a/moonpool-lwt/Moonpool_lwt__Base/index.html b/moonpool-lwt/Moonpool_lwt__Base/index.html deleted file mode 100644 index b14c0c59..00000000 --- a/moonpool-lwt/Moonpool_lwt__Base/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Moonpool_lwt__Base (moonpool-lwt.Moonpool_lwt__Base)

Module Moonpool_lwt__Base

This module is hidden.

diff --git a/moonpool-lwt/Moonpool_lwt__IO/index.html b/moonpool-lwt/Moonpool_lwt__IO/index.html deleted file mode 100644 index 498579fb..00000000 --- a/moonpool-lwt/Moonpool_lwt__IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Moonpool_lwt__IO (moonpool-lwt.Moonpool_lwt__IO)

Module Moonpool_lwt__IO

This module is hidden.

diff --git a/moonpool-lwt/Moonpool_lwt__IO_in/index.html b/moonpool-lwt/Moonpool_lwt__IO_in/index.html deleted file mode 100644 index 90869906..00000000 --- a/moonpool-lwt/Moonpool_lwt__IO_in/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Moonpool_lwt__IO_in (moonpool-lwt.Moonpool_lwt__IO_in)

Module Moonpool_lwt__IO_in

This module is hidden.

diff --git a/moonpool-lwt/Moonpool_lwt__IO_out/index.html b/moonpool-lwt/Moonpool_lwt__IO_out/index.html deleted file mode 100644 index 211ca4e4..00000000 --- a/moonpool-lwt/Moonpool_lwt__IO_out/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Moonpool_lwt__IO_out (moonpool-lwt.Moonpool_lwt__IO_out)

Module Moonpool_lwt__IO_out

This module is hidden.

diff --git a/moonpool-lwt/Moonpool_lwt__Tcp_client/index.html b/moonpool-lwt/Moonpool_lwt__Tcp_client/index.html deleted file mode 100644 index 1a98bc62..00000000 --- a/moonpool-lwt/Moonpool_lwt__Tcp_client/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Moonpool_lwt__Tcp_client (moonpool-lwt.Moonpool_lwt__Tcp_client)

Module Moonpool_lwt__Tcp_client

This module is hidden.

diff --git a/moonpool-lwt/Moonpool_lwt__Tcp_server/index.html b/moonpool-lwt/Moonpool_lwt__Tcp_server/index.html deleted file mode 100644 index 487c5ff8..00000000 --- a/moonpool-lwt/Moonpool_lwt__Tcp_server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Moonpool_lwt__Tcp_server (moonpool-lwt.Moonpool_lwt__Tcp_server)

Module Moonpool_lwt__Tcp_server

This module is hidden.

diff --git a/moonpool-lwt/_doc-dir/CHANGES.md b/moonpool-lwt/_doc-dir/CHANGES.md index 61a00a63..34e62f45 100644 --- a/moonpool-lwt/_doc-dir/CHANGES.md +++ b/moonpool-lwt/_doc-dir/CHANGES.md @@ -1,4 +1,21 @@ +# 0.9 + +- breaking: require OCaml 5 + * no further need for a preprocessor + * forkjoin not longer optional + +- moonpool-lwt: large changes, including a Runner that runs + inside `Lwt_unix`'s event loop and can thus use any `_ Lwt.t` function +- remove bounded_queue +- fix core: better repropagating of errors +- add `Fut.{cancel,try_cancel}` +- perf: `await` on immediately ready timer queues its task +- feat: add `Moonpool.yield` + +- deprecate moonpool.sync +- deprecate moonpool_io + # 0.8 - api(fut): make alias `'a Fut.t = 'a Picos.Computation.t` public diff --git a/moonpool/Moonpool/Task_local_storage/index.html b/moonpool/Moonpool/Task_local_storage/index.html index 5559726f..a0039d4d 100644 --- a/moonpool/Moonpool/Task_local_storage/index.html +++ b/moonpool/Moonpool/Task_local_storage/index.html @@ -1,2 +1,2 @@ -Task_local_storage (moonpool.Moonpool.Task_local_storage)

Module Moonpool.Task_local_storage

Task-local storage.

This storage is associated to the current task, just like thread-local storage is associated with the current thread. The storage is carried along in case the current task is suspended.

type 'a t = 'a Picos.Fiber.FLS.t
val create : unit -> 'a t

create () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.

exception Not_set
val get_exn : 'a t -> 'a

get k gets the value for the current task for key k. Must be run from inside a task running on a runner.

val get_opt : 'a t -> 'a option

get_opt k gets the current task's value for key k, or None if not run from inside the task.

val get : 'a t -> default:'a -> 'a
val set : 'a t -> 'a -> unit

set k v sets the storage for k to v. Must be run from inside a task running on a runner.

  • raises Failure

    otherwise

val with_value : 'a t -> 'a -> (unit -> 'b) -> 'b

with_value k v f sets k to v for the duration of the call to f(). When f() returns (or fails), k is restored to its old value.

Local Hmap.t

This requires hmap to be installed.

+Task_local_storage (moonpool.Moonpool.Task_local_storage)

Module Moonpool.Task_local_storage

Task-local storage.

This storage is associated to the current task, just like thread-local storage is associated with the current thread. The storage is carried along in case the current task is suspended.

type 'a t = 'a Picos.Fiber.FLS.t
val create : unit -> 'a t

create () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.

exception Not_set
val get_exn : 'a t -> 'a

get k gets the value for the current task for key k. Must be run from inside a task running on a runner.

val get_opt : 'a t -> 'a option

get_opt k gets the current task's value for key k, or None if not run from inside the task.

val get : 'a t -> default:'a -> 'a
val set : 'a t -> 'a -> unit

set k v sets the storage for k to v. Must be run from inside a task running on a runner.

  • raises Failure

    otherwise

val with_value : 'a t -> 'a -> (unit -> 'b) -> 'b

with_value k v f sets k to v for the duration of the call to f(). When f() returns (or fails), k is restored to its old value.

Local Hmap.t

This requires hmap to be installed.

val k_local_hmap : Hmap.t Picos.Fiber.FLS.t

A local hmap, inherited in children fibers

val get_local_hmap : unit -> Hmap.t

Access the local hmap, or an empty one if not set

val set_local_hmap : Hmap.t -> unit
val update_local_hmap : (Hmap.t -> Hmap.t) -> unit
val get_in_local_hmap_exn : 'a Hmap.key -> 'a
  • raises Invalid_argument

    if not present

val get_in_local_hmap_opt : 'a Hmap.key -> 'a option
val remove_in_local_hmap : 'a Hmap.key -> unit

Remove given key from the local hmap

val set_in_local_hmap : 'a Hmap.key -> 'a -> unit
val with_in_local_hmap : 'a Hmap.key -> 'a -> (unit -> 'b) -> 'b

with_in_local_hmap k v f calls f() in a context where k is bound to v in the local hmap. Then it restores the previous binding for k.

diff --git a/moonpool/Moonpool_fib/Fls/index.html b/moonpool/Moonpool_fib/Fls/index.html index 62ed4e7f..f24f6a86 100644 --- a/moonpool/Moonpool_fib/Fls/index.html +++ b/moonpool/Moonpool_fib/Fls/index.html @@ -1,2 +1,2 @@ -Fls (moonpool.Moonpool_fib.Fls)

Module Moonpool_fib.Fls

Fiber-local storage.

This storage is associated to the current fiber, just like thread-local storage is associated with the current thread.

See Moonpool.Task_local_storage for more general information, as this is based on it.

NOTE: it's important to note that, while each fiber has its own storage, spawning a sub-fiber f2 from a fiber f1 will only do a shallow copy of the storage. Values inside f1's storage will be physically shared with f2. It is thus recommended to store only persistent values in the local storage.

include module type of struct include Moonpool.Task_local_storage end
type 'a t = 'a Picos.Fiber.FLS.t
val create : unit -> 'a t

create () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.

exception Not_set
val get_exn : 'a t -> 'a

get k gets the value for the current task for key k. Must be run from inside a task running on a runner.

val get_opt : 'a t -> 'a option

get_opt k gets the current task's value for key k, or None if not run from inside the task.

val get : 'a t -> default:'a -> 'a
val set : 'a t -> 'a -> unit

set k v sets the storage for k to v. Must be run from inside a task running on a runner.

  • raises Failure

    otherwise

val with_value : 'a t -> 'a -> (unit -> 'b) -> 'b

with_value k v f sets k to v for the duration of the call to f(). When f() returns (or fails), k is restored to its old value.

Local Hmap.t

This requires hmap to be installed.

+Fls (moonpool.Moonpool_fib.Fls)

Module Moonpool_fib.Fls

Fiber-local storage.

This storage is associated to the current fiber, just like thread-local storage is associated with the current thread.

See Moonpool.Task_local_storage for more general information, as this is based on it.

NOTE: it's important to note that, while each fiber has its own storage, spawning a sub-fiber f2 from a fiber f1 will only do a shallow copy of the storage. Values inside f1's storage will be physically shared with f2. It is thus recommended to store only persistent values in the local storage.

include module type of struct include Moonpool.Task_local_storage end
type 'a t = 'a Picos.Fiber.FLS.t
val create : unit -> 'a t

create () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.

exception Not_set
val get_exn : 'a t -> 'a

get k gets the value for the current task for key k. Must be run from inside a task running on a runner.

val get_opt : 'a t -> 'a option

get_opt k gets the current task's value for key k, or None if not run from inside the task.

val get : 'a t -> default:'a -> 'a
val set : 'a t -> 'a -> unit

set k v sets the storage for k to v. Must be run from inside a task running on a runner.

  • raises Failure

    otherwise

val with_value : 'a t -> 'a -> (unit -> 'b) -> 'b

with_value k v f sets k to v for the duration of the call to f(). When f() returns (or fails), k is restored to its old value.

Local Hmap.t

This requires hmap to be installed.

val k_local_hmap : Hmap.t Picos.Fiber.FLS.t

A local hmap, inherited in children fibers

val get_local_hmap : unit -> Hmap.t

Access the local hmap, or an empty one if not set

val set_local_hmap : Hmap.t -> unit
val update_local_hmap : (Hmap.t -> Hmap.t) -> unit
val get_in_local_hmap_exn : 'a Hmap.key -> 'a
  • raises Invalid_argument

    if not present

val get_in_local_hmap_opt : 'a Hmap.key -> 'a option
val remove_in_local_hmap : 'a Hmap.key -> unit

Remove given key from the local hmap

val set_in_local_hmap : 'a Hmap.key -> 'a -> unit
val with_in_local_hmap : 'a Hmap.key -> 'a -> (unit -> 'b) -> 'b

with_in_local_hmap k v f calls f() in a context where k is bound to v in the local hmap. Then it restores the previous binding for k.

diff --git a/moonpool/Moonpool_sync/index.html b/moonpool/Moonpool_sync/index.html index fe065933..1c4e45c8 100644 --- a/moonpool/Moonpool_sync/index.html +++ b/moonpool/Moonpool_sync/index.html @@ -1,2 +1,2 @@ -Moonpool_sync (moonpool.Moonpool_sync)

Module Moonpool_sync

module Mutex = Picos_std_sync.Mutex
module Condition = Picos_std_sync.Condition
module Lock : sig ... end

Mutex-protected resource.

module Event : sig ... end
module Semaphore = Picos_std_sync.Semaphore
module Lazy = Picos_std_sync.Lazy
module Latch = Picos_std_sync.Latch
module Ivar = Picos_std_sync.Ivar
module Stream = Picos_std_sync.Stream
+Moonpool_sync (moonpool.Moonpool_sync)

Module Moonpool_sync

module Mutex = Picos_std_sync.Mutex
module Condition = Picos_std_sync.Condition
module Lock : sig ... end

Mutex-protected resource.

module Event : sig ... end
module Semaphore = Picos_std_sync.Semaphore
module Lazy = Picos_std_sync.Lazy
module Latch = Picos_std_sync.Latch
module Ivar = Picos_std_sync.Ivar
module Stream = Picos_std_sync.Stream
diff --git a/moonpool/_doc-dir/CHANGES.md b/moonpool/_doc-dir/CHANGES.md index 61a00a63..34e62f45 100644 --- a/moonpool/_doc-dir/CHANGES.md +++ b/moonpool/_doc-dir/CHANGES.md @@ -1,4 +1,21 @@ +# 0.9 + +- breaking: require OCaml 5 + * no further need for a preprocessor + * forkjoin not longer optional + +- moonpool-lwt: large changes, including a Runner that runs + inside `Lwt_unix`'s event loop and can thus use any `_ Lwt.t` function +- remove bounded_queue +- fix core: better repropagating of errors +- add `Fut.{cancel,try_cancel}` +- perf: `await` on immediately ready timer queues its task +- feat: add `Moonpool.yield` + +- deprecate moonpool.sync +- deprecate moonpool_io + # 0.8 - api(fut): make alias `'a Fut.t = 'a Picos.Computation.t` public