QueueLayerConfig<Item, A, E, R, RR>The worker config for QueueHyperlink.layer — the engine queue config without
itemSchema (the tag already carries it). The item type is the tag's itemSchema decoded
type, so effect: (item, ctx) => … is typed against it.
export type type QueueLayerConfig<
Item,
A,
E,
R,
RR = never
> = Omit<
QueueHyperlinkConfigWithItemSchema<
Item,
E,
R,
A
>,
"itemSchema" | "refill"
> & {
readonly refill?: {
readonly onStart?: boolean
readonly onDrained?: boolean
readonly load: (
queue: QueueHandle<
Item,
E,
QueueEnqueueErrors,
never,
A
>
) => Effect.Effect<void, never, RR>
}
}
The worker config for
QueueHyperlink.layer
— the engine queue config without
itemSchema (the tag already carries it). The item type is the tag's itemSchema decoded
type, so effect: (item, ctx) => … is typed against it.
QueueLayerConfig<function (type parameter) Item in type QueueLayerConfig<Item, A, E, R, RR = never>Item, function (type parameter) A in type QueueLayerConfig<Item, A, E, R, RR = never>A, function (type parameter) E in type QueueLayerConfig<Item, A, E, R, RR = never>E, function (type parameter) R in type QueueLayerConfig<Item, A, E, R, RR = never>R, function (type parameter) RR in type QueueLayerConfig<Item, A, E, R, RR = never>RR = never> = type Omit<T, K extends keyof any> = {
[P in Exclude<keyof T, K>]: T[P]
}
Construct a type with the properties of T except for those in type K.
Omit<
import QueueHyperlinkConfigWithItemSchemaQueueHyperlinkConfigWithItemSchema<function (type parameter) Item in type QueueLayerConfig<Item, A, E, R, RR = never>Item, function (type parameter) E in type QueueLayerConfig<Item, A, E, R, RR = never>E, function (type parameter) R in type QueueLayerConfig<Item, A, E, R, RR = never>R, function (type parameter) A in type QueueLayerConfig<Item, A, E, R, RR = never>A>,
"itemSchema" | "refill"
> & {
/**
* Optional self-refill. Its loader carries its **own** requirement `RR` — independent of the
* worker `R` — so a refill that pulls from a source (a repository/DB service) the worker doesn't
* use is expressible; the layer's requirement is the union `R | RR`. (Sharing one `R` would
* intersect to `never`, since the requirement channel is contravariant.)
*
* `RR` is kept to `load`'s **return** only (the handle is requirement-free here) so TS infers it
* cleanly — if `RR` also appeared on the handle parameter its variance would conflict and default
* to `never`.
*/
readonly refill?: | {
readonly onStart?: boolean
readonly onDrained?: boolean
readonly load: (
queue: QueueHandle<
Item,
E,
QueueEnqueueErrors,
never,
A
>
) => Effect.Effect<void, never, RR>
}
| undefined
Optional self-refill. Its loader carries its own requirement RR — independent of the
worker R — so a refill that pulls from a source (a repository/DB service) the worker doesn't
use is expressible; the layer's requirement is the union R | RR. (Sharing one R would
intersect to never, since the requirement channel is contravariant.)
RR is kept to load's return only (the handle is requirement-free here) so TS infers it
cleanly — if RR also appeared on the handle parameter its variance would conflict and default
to never.
refill?: {
/** Run `load` once when the worker pool starts (bootstrap). @default false */
readonly onStart?: boolean | undefinedRun load once when the worker pool starts (bootstrap).
onStart?: boolean;
/** Run `load` each time the queue drains to empty (re-poll the source). @default false */
readonly onDrained?: boolean | undefinedRun load each time the queue drains to empty (re-poll the source).
onDrained?: boolean;
/** Load + enqueue work from a source. Handle its own errors (best-effort). */
readonly load: (
queue: QueueHandle<
Item,
E,
QueueEnqueueErrors,
never,
A
>
) => Effect.Effect<void, never, RR>
Load + enqueue work from a source. Handle its own errors (best-effort).
load: (
queue: QueueHandle<
Item,
E,
QueueEnqueueErrors,
never,
A
>
queue: import QueueHandleQueueHandle<function (type parameter) Item in type QueueLayerConfig<Item, A, E, R, RR = never>Item, function (type parameter) E in type QueueLayerConfig<Item, A, E, R, RR = never>E, import QueueEnqueueErrorsQueueEnqueueErrors, never, function (type parameter) A in type QueueLayerConfig<Item, A, E, R, RR = never>A>,
) => import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<void, never, function (type parameter) RR in type QueueLayerConfig<Item, A, E, R, RR = never>RR>;
};
};