package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/octez-libs.tezos-workers/Tezos_workers/Worker/MakeSingle/index.html
Module Worker.MakeSingle
Source
MakeSingle (Name) (Request) (Types)
is the same as using MakeGroup
and then MakeWorker
. It's a special case which you can use if you only ever need a single instantiation.
Parameters
module Name : Tezos_base.Worker_intf.NAME
module Request : Tezos_base.Worker_intf.REQUEST
module Types : Tezos_base.Worker_intf.TYPES
Signature
module Name = Name
module Request = Request
module Types = Types
A handle to a specific worker, parameterized by the type of internal message buffer.
A handle to a table of workers.
type 'a message_error =
| Closed of Tezos_base.TzPervasives.error list option
| Request_error of 'a
| Any of exn
An error returned when waiting for a message pushed to the worker. Closed errs
is returned if the worker is terminated or has crashed. If the worker is terminated, errs
is an empty list. Request_error err
is returned if the request failed with an error. Any exn
is returned if the request failed with an exception.
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.
Create a table of workers.
val launch :
'kind table ->
?timeout:Tezos_base.Time.System.Span.t ->
Name.t ->
Types.parameters ->
(module HANDLERS
with type launch_error = 'launch_error
and type self = 'kind t) ->
('kind t, 'launch_error) 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.
The following interface are common elements of multiple modules below. They are used to minimize repetition.
Exports the canceler to allow cancellation of other tasks when this worker is shutdown or when it dies.
Access the internal state, once initialized.
val with_state :
_ t ->
(Types.state -> (unit, 'request_error) result Lwt.t) ->
(unit, 'request_error) result Lwt.t
with_state w f
calls f
on the current state of worker w
if it was intialized and not closed or crashed, otherwise returns immediately.
Introspect the message queue, gives the times requests were pushed.
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.