Etage-0.1.12: A general data-flow framework

Safe HaskellNone



This module defines a worker Neuron which evaluates IO actions it receives. It is useful to offload lengthly IO actions into another thread. In the case of too many queued IO actions they are silently dropped and only newest ones are evaluated. You grow it in Incubation by using something like:

 nerveWorker <- (growNeuron :: NerveOnlyFor WorkerNeuron) defaultOptions

It is an example of a Neuron which defines getNeuronMapCapability. It processes only the newest Impulses it receives, when they get queued, so Impulses are dropped if load is too high.



type WorkerFromImpulse = NeuronFromImpulse WorkerNeuronSource

Impulses from WorkerNeuron. This Neuron does not define any Impulses it would send, NoImpulse.

data WorkerForImpulse Source




impulseTimestamp :: ImpulseTime

Time when the action was enqueued for evaluation in the WorkerNeuron.

work :: WorkType

Enqueued action.

type WorkerOptions = NeuronOptions WorkerNeuronSource

Options for WorkerNeuron. This option is defined:

mapOnCapability :: NeuronMapCapability
How to map the Neuron on capabilities (OS threads). With this option you can fix multiple Neurons on the same capability (for example, by generating one value with mkNeuronMapOnRandomCapability and using it for all those Neurons) which is sometimes necessary when dealing with external (FFI) libraries. Default value is NeuronFreelyMapOnCapability.

type WorkType = IO ()Source

Type of work this worker Neuron evaluates.