This PR implements the improved Queue shutdown functionality as proposed in #9844. It introduces a dedicated error type E to Queue (via ZQueue) and adds the shutdownCause method, allowing for more robust error propagation and resource disposal during queue shutdown.
ZDequeue[+E, +A], ZEnqueue[+E, -A], and ZQueue[E, A] to support a dedicated error type E.Dequeue[+A], Enqueue[-A], and Queue[A] as type aliases for the Nothing error case in package.scala.shutdownCause(cause: Cause[E])(implicit trace: Trace): UIO[Chunk[A]] to ZDequeue, ZEnqueue, and ZQueue.shutdownCause method is atomic; the first caller “wins” and sets the cause. It also returns all items currently buffered in the queue, allowing for proper resource disposal.offer, take, size) will now fail with the specified Cause[E] instead of simply being interrupted.take, offer, takeAll, offerAll, and other core methods to return IO[E, ...] instead of UIO[...].shutdownCause.ZStream.fromQueue and ZStream.fromQueueWithShutdown to handle the new error type. Streams created from a queue will now fail with the queue’s shutdown cause.Hub.scala to maintain consistency with the new ZEnqueue and ZDequeue traits.QueueShutdownCauseSpec.scala covering:
shutdownCause.ZStream failure propagation.QueueSpec.scala continue to pass./claim #9844
closes: #9844
Supreme Labs
@supreme2580
Supreme Labs
@supreme2580
ZIO
@ZIO