class PG::MessageReader
Reads backend messages one at a time from a source of bytes: the 5-byte header, then the body, never further.
Constants
MAX_LENGTH: Int
Messages longer than this are refused as a broken stream (the server sends rows of at most 1 GB, plus their framing).
Class methods
def self.new(io: IO) -> PG::MessageReader
Reads from io (a socket).
def self.new(read: (Int) -> Bytes) -> PG::MessageReader
Reads with read, which gives up to its argument's count of bytes
and nothing at the end of the stream.
Methods
def read -> PG::Backend
The next message. Raises PG::ConnectionError when the stream ends,
and PG::ProtocolError for a message that does not parse.