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.

type launch_error

The type of errors happening when launching an instance of a worker.

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_error) Request.t -> ('a, 'request_error) result Lwt.t

The main request processor, i.e. the body of the event loop.

val on_no_request : self -> unit 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 -> Tezos_base.Worker_types.request_status -> ('a, 'request_error) Request.t -> 'request_error -> unit Tezos_base.TzPervasives.tzresult Lwt.t

A function called at the end of the worker loop in case of an error. One can first log the incoming error. Then, the error can be filtered out by returning return_unit and the worker execution continues, or the error can be propagated through a tzresult, making the worker crash.

val on_completion : self -> ('a, 'request_error) 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.