class PG::MessageReader

Reads backend messages one at a time from a source of bytes: the 5-byte header, then the body, never further.

src/wire.qz:160

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

src/wire.qz:163

Class methods

def self.new(io: IO) -> PG::MessageReader

Reads from io (a socket).

src/wire.qz:168

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.

src/wire.qz:174

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.

src/wire.qz:178