| 14 | import * as TxRef from "effect/TxRef"; |
| 15 | |
| 16 | export interface DrainableWorker<A> { |
| 17 | /** |
| 18 | * Enqueue a work item and track it for `drain()`. |
| 19 | * |
| 20 | * This wraps `Queue.offer` so drain state is updated atomically with the |
| 21 | * enqueue path instead of inferring it from queue internals. |
| 22 | */ |
| 23 | readonly enqueue: (item: A) => Effect.Effect<void>; |
| 24 | |
| 25 | /** |
| 26 | * Resolves when the queue is empty and the worker is idle (not processing). |
| 27 | */ |
| 28 | readonly drain: Effect.Effect<void>; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Create a drainable worker that processes items from an unbounded queue. |
nothing calls this directly
no outgoing calls
no test coverage detected