Library
Module
Module type
Parameter
Class
Class type
module Name : Tezos_base.Worker_intf.NAME
module Event : Tezos_base.Worker_intf.EVENT
module Request : Tezos_base.Worker_intf.REQUEST
module Types : Tezos_base.Worker_intf.TYPES
module Logger :
Tezos_base.Worker_intf.LOGGER
with module Event = Event
and type Request.view = Request.view
module Name = Name
module Event = Event
module Request = Request
module Types = Types
Internal buffer kinds used as parameters to t
.
type _ buffer_kind =
| Queue : infinite queue buffer_kind
| Bounded : {
} -> bounded queue buffer_kind
| Dropbox : {
merge : dropbox t -> any_request -> any_request option -> any_request option;
} -> dropbox buffer_kind
Supported kinds of internal buffers.
val create_table : 'kind buffer_kind -> 'kind table
Create a table of workers.
module type HANDLERS = sig ... end
The callback handlers specific to each worker instance.
val launch :
'kind table ->
?timeout:Tezos_base.Time.System.Span.t ->
Name.t ->
Types.parameters ->
(module HANDLERS with type self = 'kind t) ->
('kind t, Tezos_error_monad.TzCore.error list) result Lwt.t
Creates a new worker instance. Parameter queue_size
not passed means unlimited queue.
Triggers a worker termination and waits for its completion. Cannot be called from within the handlers.
module type BOX = sig ... end
The following interface are common elements of multiple modules below. They are used to minimize repetition.
module type QUEUE = sig ... end
module Dropbox : sig ... end
module Queue : sig ... end
val protect :
_ t ->
?on_error:
(Tezos_error_monad.TzCore.error list ->
('b, Tezos_error_monad.TzCore.error list) result Lwt.t) ->
(unit -> ('b, Tezos_error_monad.TzCore.error list) result Lwt.t) ->
('b, Tezos_error_monad.TzCore.error list) result Lwt.t
Detects cancellation from within the request handler to stop asynchronous operations.
val canceler : _ t -> Lwt_canceler.t
Exports the canceler to allow cancellation of other tasks when this worker is shutdown or when it dies.
val trigger_shutdown : _ t -> unit
Triggers a worker termination.
val state : _ t -> Types.state
Access the internal state, once initialized.
val pending_requests :
_ queue t ->
(Tezos_base.Time.System.t * Request.view) list
Introspect the message queue, gives the times requests were pushed.
val status : _ t -> Tezos_base.Worker_types.worker_status
Get the running status of a worker.
val current_request :
_ t ->
(Tezos_base.Time.System.t * Tezos_base.Time.System.t * Request.view) option
Get the request being treated by a worker. Gives the time the request was pushed, and the time its treatment started.
val information : _ t -> Tezos_base.Worker_types.worker_information