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 @@ + +
Hmap.KeyKeys.
val create : unit -> 'a keycreate () is a new key.
Exisential keys allows to compare keys. This can be useful for functions like filter.
Make.KeyKeys.
type 'a info = 'a Key_info.tThe type for key information.
Exisential keys allow to compare keys. This can be useful for functions like filter.
Make.Key_infoHmap.MakeFunctor for heterogeneous maps whose keys hold information of type Key_info.t
module Key : sig ... endKeys.
val empty : tempty is the empty map.
val is_empty : t -> boolis_empty m is true iff m is empty.
fold f m acc folds over the bindings of m with f, starting with acc
exists p m is true iff there exists a bindings of m that satisfies p.
val cardinal : t -> intcardinal m is the number of bindings in m.
HmapHeterogeneous value maps.
v0.8.1 - homepage
module Key : sig ... endKeys.
val empty : tempty is the empty map.
val is_empty : t -> boolis_empty m is true iff m is empty.
fold f m acc folds over the bindings of m with f, starting with acc
exists p m is true iff there exists a bindings of m that satisfies p.
val cardinal : t -> intcardinal m is the number of bindings in m.
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 ... endThe type for key information.
Hmap.KEY_INFOThe type for key information.
S.KeyKeys.
Exisential keys allow to compare keys. This can be useful for functions like filter.
Hmap.SOutput signature of the functor Make
module Key : sig ... endKeys.
val empty : tempty is the empty map.
val is_empty : t -> boolis_empty m is true iff m is empty.
fold f m acc folds over the bindings of m with f, starting with acc
exists p m is true iff there exists a bindings of m that satisfies p.
val cardinal : t -> intcardinal m is the number of bindings in m.
Hmap Heterogeneous value maps.Browse by name, by tag, the standard library and the OCaml manual (online, latest version).
Generated for /home/runner/work/moonpool/moonpool/_opam/lib
Browse by name, by tag, the standard library and the OCaml manual (online, latest version).
Generated for /home/runner/work/moonpool/moonpool/_opam/lib
Moonpool_lwt.IOIO 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 -> intRead from the file descriptor
val await_readable : Unix.file_descr -> unitSuspend the fiber until the FD is readable
val write_once : Unix.file_descr -> bytes -> int -> int -> intPerform one write into the file descriptor
val await_writable : Unix.file_descr -> unitSuspend the fiber until the FD is writable
val write : Unix.file_descr -> bytes -> int -> int -> unitLoop around write_once to write the entire slice.
IO_in.tRead into the slice. Returns 0 only if the stream is closed.
Moonpool_lwt.IO_inInput channel
class type t = object ... endval create :
- ?close:(unit -> unit) ->
- input:(bytes -> int -> int -> int) ->
- unit ->
- tval empty : tval of_bytes : ?off:int -> ?len:int -> bytes -> tval of_string : ?off:int -> ?len:int -> string -> tval input : t -> bytes -> int -> int -> intRead into the given slice.
val really_input : t -> bytes -> int -> int -> unitval really_input_string : t -> int -> stringval input_all : ?buf:bytes -> t -> stringval of_unix_fd : ?close_noerr:bool -> ?buf:bytes -> Unix.file_descr -> tIO_out.tMoonpool_lwt.IO_outOutput channel
class type t = object ... endval create :
- ?flush:(unit -> unit) ->
- ?close:(unit -> unit) ->
- output_char:(char -> unit) ->
- output:(bytes -> int -> int -> unit) ->
- unit ->
- tval dummy : tval of_unix_fd : ?close_noerr:bool -> ?buf:bytes -> Unix.file_descr -> tval of_buffer : Stdlib.Buffer.t -> tval output_char : t -> char -> unitOutput the buffer slice into this channel
val output : t -> bytes -> int -> int -> unitOutput the buffer slice into this channel
val output_string : t -> string -> unitval output_line : t -> string -> unitval output_int : t -> int -> unitval output_lines : t -> string Stdlib.Seq.t -> unitMoonpool_lwt.TCP_clientval connect : Unix.sockaddr -> Unix.file_descrval with_connect : Unix.sockaddr -> (IO_in.t -> IO_out.t -> 'a) -> 'aOpen 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) ->
- 'aOpen a connection.
Moonpool_lwt.TCP_servertype t = Lwt_io.serverval establish_lwt :
- ?backlog:int ->
- ?no_close:bool ->
- runner:Moonpool.Runner.t ->
- Unix.sockaddr ->
- (Unix.sockaddr -> Lwt_io.input_channel -> Lwt_io.output_channel -> unit) ->
- testablish ~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) ->
- tLike establish_lwt but uses IO to directly handle reads and writes on client sockets.
val shutdown : t -> unitShutdown the server
Moonpool_lwtLwt_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.Fibermodule FLS = Moonpool_fib.Flsval fut_of_lwt : 'a Lwt.t -> 'a Moonpool.Fut.tfut_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.tlwt_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.
val await_lwt : 'a Lwt.t -> 'aawait_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.trun_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) -> 'arun_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.tReturns the runner from within which this is called. Must be run from within a fiber.
module IO : sig ... endIO using the Lwt event loop.
module IO_in : sig ... endInput channel
module IO_out : sig ... endOutput channel
module TCP_server : sig ... endmodule TCP_client : sig ... endval detach_in_runner : runner:Moonpool.Runner.t -> (unit -> 'a) -> 'a Lwt.tdetach_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.
val main_with_runner : runner:Moonpool.Runner.t -> (unit -> 'a) -> 'amain_with_runner ~runner f starts a Lwt-based event loop and runs f() inside a fiber in runner.
Like main_with_runner but with a default choice of runner.
Moonpool_lwtLwt_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.Futval fut_of_lwt : 'a Lwt.t -> 'a Moonpool.Fut.tfut_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.tlwt_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.
val spawn_lwt : (unit -> 'a) -> 'a Lwt.tThis spawns a task that runs in the Lwt scheduler.
Like spawn_lwt but ignores the result, like Lwt.async.
val await_lwt : 'a Lwt.t -> 'aawait_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 on_uncaught_exn : (Moonpool.Exn_bt.t -> unit) refval lwt_main : (Moonpool.Runner.t -> 'a) -> 'alwt_main f sets the moonpool-lwt bridge up, runs lwt main, calls f, destroys the bridge, and return the result of f().
on_lwt_thread () is true if the current thread is the one currently running lwt_main.
val lwt_main_runner : unit -> Moonpool.Runner.tMoonpool_lwt__This module is hidden.
Moonpool_lwt__BaseThis module is hidden.
Moonpool_lwt__IOThis module is hidden.
Moonpool_lwt__IO_inThis module is hidden.
Moonpool_lwt__IO_outThis module is hidden.
Moonpool_lwt__Tcp_clientThis module is hidden.
Moonpool_lwt__Tcp_serverThis module is hidden.
Moonpool.Task_local_storageTask-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.tval create : unit -> 'a tcreate () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.
val get_exn : 'a t -> 'aget 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 optionget_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 -> 'aval set : 'a t -> 'a -> unitset k v sets the storage for k to v. Must be run from inside a task running on a runner.
val with_value : 'a t -> 'a -> (unit -> 'b) -> 'bwith_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.
Hmap.tThis requires hmap to be installed.
Moonpool.Task_local_storageTask-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.tval create : unit -> 'a tcreate () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.
val get_exn : 'a t -> 'aget 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 optionget_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 -> 'aval set : 'a t -> 'a -> unitset k v sets the storage for k to v. Must be run from inside a task running on a runner.
val with_value : 'a t -> 'a -> (unit -> 'b) -> 'bwith_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.
Hmap.tThis requires hmap to be installed.
val k_local_hmap : Hmap.t Picos.Fiber.FLS.tA local hmap, inherited in children fibers
val get_local_hmap : unit -> Hmap.tAccess the local hmap, or an empty one if not set
val set_local_hmap : Hmap.t -> unitval get_in_local_hmap_exn : 'a Hmap.key -> 'aval get_in_local_hmap_opt : 'a Hmap.key -> 'a optionval remove_in_local_hmap : 'a Hmap.key -> unitRemove given key from the local hmap
val set_in_local_hmap : 'a Hmap.key -> 'a -> unitval with_in_local_hmap : 'a Hmap.key -> 'a -> (unit -> 'b) -> 'bwith_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.
Moonpool_fib.FlsFiber-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 endtype 'a t = 'a Picos.Fiber.FLS.tval create : unit -> 'a tcreate () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.
val get_exn : 'a t -> 'aget 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 optionget_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 -> 'aval set : 'a t -> 'a -> unitset k v sets the storage for k to v. Must be run from inside a task running on a runner.
val with_value : 'a t -> 'a -> (unit -> 'b) -> 'bwith_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.
Hmap.tThis requires hmap to be installed.
Moonpool_fib.FlsFiber-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 endtype 'a t = 'a Picos.Fiber.FLS.tval create : unit -> 'a tcreate () makes a new key. Keys are expensive and should never be allocated dynamically or in a loop.
val get_exn : 'a t -> 'aget 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 optionget_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 -> 'aval set : 'a t -> 'a -> unitset k v sets the storage for k to v. Must be run from inside a task running on a runner.
val with_value : 'a t -> 'a -> (unit -> 'b) -> 'bwith_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.
Hmap.tThis requires hmap to be installed.
val k_local_hmap : Hmap.t Picos.Fiber.FLS.tA local hmap, inherited in children fibers
val get_local_hmap : unit -> Hmap.tAccess the local hmap, or an empty one if not set
val set_local_hmap : Hmap.t -> unitval get_in_local_hmap_exn : 'a Hmap.key -> 'aval get_in_local_hmap_opt : 'a Hmap.key -> 'a optionval remove_in_local_hmap : 'a Hmap.key -> unitRemove given key from the local hmap
val set_in_local_hmap : 'a Hmap.key -> 'a -> unitval with_in_local_hmap : 'a Hmap.key -> 'a -> (unit -> 'b) -> 'bwith_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.
Moonpool_syncmodule Mutex = Picos_std_sync.Mutexmodule Condition = Picos_std_sync.Conditionmodule Lock : sig ... endMutex-protected resource.
module Event : sig ... endmodule Semaphore = Picos_std_sync.Semaphoremodule Lazy = Picos_std_sync.Lazymodule Latch = Picos_std_sync.Latchmodule Ivar = Picos_std_sync.Ivarmodule Stream = Picos_std_sync.StreamMoonpool_syncmodule Mutex = Picos_std_sync.Mutexmodule Condition = Picos_std_sync.Conditionmodule Lock : sig ... endMutex-protected resource.
module Event : sig ... endmodule Semaphore = Picos_std_sync.Semaphoremodule Lazy = Picos_std_sync.Lazymodule Latch = Picos_std_sync.Latchmodule Ivar = Picos_std_sync.Ivarmodule Stream = Picos_std_sync.Stream