class Movie::Remote::OutboundWriter

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.cr

Constant Summary

DEFAULT_MAX_BATCH_BYTES = 64 * 1024
DEFAULT_MAX_BATCH_FRAMES = 128
DEFAULT_QUEUE_CAPACITY = 4096
Log = ::Log.for(self)

Constructors

Instance Method Summary

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) #

[View source]
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) #

[View source]

Instance Method Detail

def close : Nil #

Stops accepting work, releases blocked producers, and discards envelopes that cannot be delivered after connection shutdown.


[View source]
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.


[View source]
def start : Bool #

Starts the single writer fiber. Envelopes may be enqueued before start.


[View source]