Skip to main content

Module read

Module read 

Source
Expand description

Statements that return rows.

§A read never persists anything

The session opens with automatic confirmation switched off, so anything a read touched is discarded when the connection closes at the end of the invocation. The guarantee therefore does not depend on the classification being right: even a change that escaped the classifier and travelled here would leave nothing behind. There is no flag that switches this off.

§A row is never held longer than it takes to write it

stream hands each row to the output flow and forgets it, so a million rows cost the same memory as one and the caller sees the first row while the server is still sending the last. The output operations run as stages of that flow, so a ceiling, a filter, a projection or a deduplication no longer costs the whole set being gathered first. The flow ends with the record that declares it complete, and a connection that drops mid-way leaves the output without that record, which is exactly how a cut set is told from a whole one.

collect exists for the answer that travels inside a single envelope, where the whole set is the payload by definition. It obeys the row ceiling, and declares a gap when the ceiling cut the answer short.

Structs§

ReadResult
The rows of one read, together with what the ceiling did to them.

Functions§

collect
Runs a read and collects its rows, obeying the ceiling.
column_names
The labels the declared columns are carried under, in order.
convert_row
Converts one wire row into the shape the output pipeline carries.
refuse_if_not_a_read
Refuses a statement asked to be read that does not read.
sample_request
Builds the statement that returns the first rows of a table.
serve
Runs a read under the ceiling and shapes the payload it answers with.
stream
Runs a read and writes each row straight onto the flow.
with_ceiling
Imposes this tool’s own row ceiling on a statement that returns rows.