class

HT2::MultiFrameWriter

Inherits Reference < Object

Optimized multi-frame writer that batches frame writes to minimize I/O operations and memory allocations. Supports zero-copy for DATA frames and efficient serialization for other frame types.

Constants

DEFAULT_BUFFER_SIZE = 65536

Default write buffer size (64KB)

MAX_BATCH_SIZE = 100

Maximum frames to batch before forcing a flush

Constructors

for_connection(connection : Connection) : MultiFrameWriter

Create a connection-specific writer

Source
new(buffer_pool : BufferPool, adaptive_buffer_manager : AdaptiveBufferManager | Nil = nil, buffer_size : Int32 | Nil = nil)
Source

Class methods

write_data_frames(io : IO, stream_id : UInt32, data_chunks : Array(Bytes), end_stream : Bool = false) : Nil

Optimized batch writer for multiple DATA frames from the same stream

Source
write_headers_with_continuations(io : IO, stream_id : UInt32, header_block : Bytes, end_stream : Bool = false, priority : PriorityData | Nil = nil, max_frame_size : UInt32 = DEFAULT_MAX_FRAME_SIZE) : Nil

Optimized writer for HEADERS + CONTINUATION frames

Source

Instance methods

adaptive_buffer_manager
Source
add_frame(frame : Frame) : Nil

Add a single frame to the write queue

Source
add_frames(frames : Array(Frame)) : Nil

Add multiple frames at once

Source
add_prioritized_frames(frames : Array(PrioritizedFrame)) : Nil

Add prioritized frames that will be sent in priority order

Source
buffer_pool
Source
buffered_bytes

Get the number of bytes currently buffered

Source
buffered_frames

Get the number of frames currently buffered

Source
flush_to(io : IO) : Nil

Flush all pending frames to the given IO

Source
release

Release resources back to buffer pool

Source
write_buffer
Source
write_mutex
Source

Nested types