class
Movie::Remote::OutboundWriter
- Movie::Remote::OutboundWriter
- Reference
- Object
Overview
Connection-owned bounded FIFO that moves frame encoding and socket writes off actor caller fibers. Producers only wait when the queue is saturated.
Defined in:
movie/remote/outbound_writer.crConstant Summary
-
DEFAULT_MAX_BATCH_BYTES =
64 * 1024 -
DEFAULT_MAX_BATCH_FRAMES =
128 -
DEFAULT_QUEUE_CAPACITY =
4096 -
Log =
::Log.for(self)
Constructors
- .new(io : IO, queue_capacity : Int32 = DEFAULT_QUEUE_CAPACITY, max_batch_frames : Int32 = DEFAULT_MAX_BATCH_FRAMES, max_batch_bytes : Int32 = DEFAULT_MAX_BATCH_BYTES, on_error : Proc(Exception, Nil) | Nil = nil)
- .new(io : IO, queue_capacity : Int32 = DEFAULT_QUEUE_CAPACITY, max_batch_frames : Int32 = DEFAULT_MAX_BATCH_FRAMES, max_batch_bytes : Int32 = DEFAULT_MAX_BATCH_BYTES, &on_error : Exception -> Nil)
Instance Method Summary
-
#close : Nil
Stops accepting work, releases blocked producers, and discards envelopes that cannot be delivered after connection shutdown.
-
#enqueue(envelope : WireEnvelope) : Bool
Enqueues in FIFO order.
-
#start : Bool
Starts the single writer fiber.
Constructor Detail
def self.new(io : IO, queue_capacity : Int32 = DEFAULT_QUEUE_CAPACITY, max_batch_frames : Int32 = DEFAULT_MAX_BATCH_FRAMES, max_batch_bytes : Int32 = DEFAULT_MAX_BATCH_BYTES, on_error : Proc(Exception, Nil) | Nil = nil)
#
def self.new(io : IO, queue_capacity : Int32 = DEFAULT_QUEUE_CAPACITY, max_batch_frames : Int32 = DEFAULT_MAX_BATCH_FRAMES, max_batch_bytes : Int32 = DEFAULT_MAX_BATCH_BYTES, &on_error : Exception -> Nil)
#
Instance Method Detail
def close : Nil
#
Stops accepting work, releases blocked producers, and discards envelopes that cannot be delivered after connection shutdown.
def enqueue(envelope : WireEnvelope) : Bool
#
Enqueues in FIFO order. When the bounded queue is full, the producer is backpressured until the writer drains capacity or the writer closes.