Tezos_bees.Hive
Hive is used to abstract and launch a pool of worker bees. A single hive should be used per process. Must be used within Event_loop.main_run
continuation.
val launch_worker :
?switch:Eio.Switch.t ->
'worker ->
bee_name:string ->
domains:int ->
(int -> 'worker -> [ `Stop_daemon ]) ->
unit
launch_worker worker bee_name domains worker_loop
starts domains
domains running the worker_loop to handle worker requests. worker_loop
takes the domain number. If no switch
is provided, the Event_loop's main switch will be used.
get_error bee_name
returns any eio-related error associated with the worker bee_name
.
Delegate the execution of an Lwt promise to a specialized worker. Beware of the fact that the Lwt.t promise won't be resolved as soon as async_lwt
returns, but (as suggested by the function name) asynchronously.
This means that try async_lwt closure with _ -> ...
will not catch an exception raised by the execution of the closure. If the closure raises an exception, it will break the internal lwt loop and prevent any subsequent asynchronous call to be executed. It's consequently advised to handle exceptions directly in the closure and return a result
.