zio.blocks.mux
Members list
Type members
Classlikes
This object was generated by sbt-buildinfo.
This object was generated by sbt-buildinfo.
Attributes
- Source
- BuildInfo.scala
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Self type
-
BuildInfo.type
A multiplexer that manages multiple independent streams over a shared transport.
A multiplexer that manages multiple independent streams over a shared transport.
Each stream is identified by a unique Id and has independent inbound/outbound message queues. The multiplexer enforces a maximum number of concurrent streams (capacity). Attempting to open a stream beyond that limit returns MuxError.CapacityExceeded.
'''Invariants:'''
- Stream IDs must be unique among active streams; opening a duplicate returns MuxError.ProtocolError.
capacityis fixed at construction and never changes.- After closeAll, no new streams can be opened (MuxError.MuxClosed is returned) and all previously active streams transition to CLOSED with the supplied error enqueued for any pending receive.
'''Thread safety:''' open, get, cancel, closeAll, and activeCount are safe to call from multiple threads concurrently. Per-stream operations on MuxStream: send and offerInbound are multi-thread safe. receive and takeOutbound must each be called from a single consumer thread at a time (single-consumer contract of the underlying ring buffer).
Type parameters
- Id
-
Stream identifier type (e.g.,
Intfor HTTP/2 stream IDs) - In
-
Message type sent on streams (outbound from user code)
- Out
-
Message type received on streams (inbound to user code)
Attributes
Multiplexer for ID-multiplexed protocols (HTTP/2, QUIC, etc.).
Multiplexer for ID-multiplexed protocols (HTTP/2, QUIC, etc.).
Manages multiple concurrent streams, each identified by a unique ID. Streams are independent and can be opened, closed, or cancelled independently.
Type parameters
- Id
-
Stream identifier type (e.g., Int for HTTP/2)
- In
-
Message type sent on streams
- Out
-
Message type received on streams
Attributes
Error type for Mux operations.
Error type for Mux operations.
The id field in MuxError.StreamClosed and MuxError.Cancelled is typed as Any to keep MuxError non-generic. Parameterizing the sealed hierarchy on the stream ID type would make pattern matching and error handling unwieldy across different Mux instances. Callers can recover the concrete ID type via pattern matching at the use site.
Attributes
- Companion
- object
- Source
- MuxError.scala
- Supertypes
- Known subtypes
-
class Cancelledclass CapacityExceededobject MuxClosedclass ProtocolErrorclass QueueFullclass StreamClosedShow all
Attributes
- Companion
- trait
- Source
- MuxError.scala
- Supertypes
- Self type
-
MuxError.type
Individual stream within a Mux.
Individual stream within a Mux.
Encapsulates the state machine for a single stream (IDLE, OPEN, HALF_CLOSED_LOCAL, HALF_CLOSED_REMOTE, CLOSED). Provides send/receive operations and state queries.
This stream has two separate message queues:
- '''Outbound queue''': messages sent by user code via
send(), drained by the mux/protocol viatakeOutbound() - '''Inbound queue''': messages delivered by the mux/protocol via
offerInbound(), read by user code viareceive()
Type parameters
- Id
-
Stream identifier type
- In
-
Message type sent on this stream
- Out
-
Message type received on this stream
Attributes
- Source
- Mux.scala
- Supertypes