class
GRPC::Transport::LiveSendBuffer
- GRPC::Transport::LiveSendBuffer
- Reference
- Object
Overview
LiveSendBuffer is an on-demand queue for full-duplex bidi streaming. DATA_READ_CB_LIVE returns NGHTTP2_ERR_DEFERRED when the queue is empty, and the caller must call session_resume_data after pushing new data.
When capacity > 0 the buffer is bounded: push blocks the calling fiber until a slot is available, providing backpressure to the sender. capacity == 0 (default) means unbounded.
Lock ordering: callers must NOT hold @lsb_mutex while acquiring the connection @mutex. read_into is called from inside the connection @mutex, so it acquires @lsb_mutex as an inner lock — which is safe because push/close always release @lsb_mutex before the caller acquires the connection @mutex (via send_resume_proc).
Defined in:
grpc/transport/http2_client_connection.crConstructors
Instance Method Summary
- #close : Nil
- #closed? : Bool
- #push(bytes : Bytes) : Nil
-
#read_into(buf : Pointer(UInt8), length : LibC::SizeT, data_flags : Pointer(UInt32)) : LibC::SSizeT
read_into fills buf with up to length bytes from the queue.
- #take_resume_request : Bool
Constructor Detail
Instance Method Detail
read_into fills buf with up to length bytes from the queue. Returns the number of bytes written, sets DATA_FLAG_EOF when done, or returns NGHTTP2_ERR_DEFERRED when no data is available yet. Called from DATA_READ_CB_LIVE while the connection @mutex is held.