package tezos-workers
Library
Module
Module type
Parameter
Class
Class type
The callback handlers specific to each worker instance.
val on_launch :
self ->
Name.t ->
Types.parameters ->
(Types.state, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
Builds the initial internal state of a worker at launch. It is possible to initialize the message queue. Of course calling state
will fail at that point.
val on_request :
self ->
'a Request.t ->
('a, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
The main request processor, i.e. the body of the event loop.
val on_no_request :
self ->
(unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
Called when no request has been made before the timeout, if the parameter has been passed to launch
.
val on_close : self -> unit Lwt.t
A function called when terminating a worker.
val on_error :
self ->
Request.view ->
Tezos_base.Worker_types.request_status ->
Tezos_error_monad.TzCore.error list ->
(unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t
A function called at the end of the worker loop in case of an abnormal error. This function can handle the error by returning Ok ()
, or leave the default unexpected error behavior by returning its parameter. A possibility is to handle the error for ad-hoc logging, and still use trigger_shutdown
to kill the worker.
val on_completion :
self ->
'a Request.t ->
'a ->
Tezos_base.Worker_types.request_status ->
unit Lwt.t
A function called at the end of the worker loop in case of a successful treatment of the current request.