pub trait TempRun: Send {
// Required methods
fn append(&mut self, bytes: &[u8]) -> Result<(), TempStoreError>;
fn seal(&mut self) -> Result<(), TempStoreError>;
fn read(&mut self, buf: &mut [u8]) -> Result<usize, TempStoreError>;
fn bytes_written(&self) -> u64;
}Expand description
One spill run: written once in sorted order, then read back once in that same order by a merge cursor.
The two phases are deliberate — a run is never appended to after it is sealed, and never seeks. That is all an external merge needs, and keeping the contract that narrow means a host implementation is a file handle and nothing else.
Dropping a run MUST remove its backing storage: a cancelled or panicking query has no other chance to clean up.
Required Methods§
Sourcefn seal(&mut self) -> Result<(), TempStoreError>
fn seal(&mut self) -> Result<(), TempStoreError>
End the write phase and rewind for reading.
Sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize, TempStoreError>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, TempStoreError>
Fill buf from the current read position. Ok(0) is EOF.
Sourcefn bytes_written(&self) -> u64
fn bytes_written(&self) -> u64
Bytes appended so far. Round 884 wired this to PG’s
pg_stat_database.temp_bytes, read after seal so the figure is
what the run really holds; the comment here used to say the
column was hard-coded 0, and it was.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".