package tezos-workers

  1. Overview
  2. Docs

The callback handlers specific to each worker instance.

type self

Placeholder replaced with t with the right parameters provided by the type of buffer chosen at launch.

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) 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) 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.

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.

OCaml

Innovation. Community. Security.