pub struct SnapshotPager { /* private fields */ }Expand description
A bounded, finite read over one PostgreSQL repeatable-read snapshot.
The pager owns the connection-bound transaction. It does not accept an arbitrary executor and never releases the transaction between pages. A pager is intentionally not a stream: callers choose explicit page bounds and must finish or roll back the read transaction.
The pager is deliberately not Send: the snapshot and its connection must
stay with the executor that created them.
use dovecote_sqlx_postgres::SnapshotPager;
fn requires_send<T: Send>() {}
fn main() {
requires_send::<SnapshotPager>();
}Implementations§
Source§impl SnapshotPager
impl SnapshotPager
Sourcepub const fn cursor(&self) -> Option<RowId>
pub const fn cursor(&self) -> Option<RowId>
Returns the last row ID returned by a non-empty page.
Sourcepub const fn upper_bound(&self) -> Option<RowId>
pub const fn upper_bound(&self) -> Option<RowId>
Returns the maximum row ID visible to this pager’s finite export.
Sourcepub const fn is_exhausted(&self) -> bool
pub const fn is_exhausted(&self) -> bool
Returns whether the pager has returned its final page.
Sourcepub async fn next_page(
&mut self,
limit: Limit,
) -> Result<Vec<PagedEvent>, PageError>
pub async fn next_page( &mut self, limit: Limit, ) -> Result<Vec<PagedEvent>, PageError>
Reads the next bounded page from the retained snapshot.
An empty page marks the pager exhausted and does not advance its
cursor. Once exhausted, subsequent calls return an empty page without
issuing SQL; call finish or
rollback to release the transaction explicitly.
§Errors
Returns an error if a stored event or delivery cannot be validated or the database read fails. Roll back or drop the pager after a failed read.
Sourcepub async fn finish(self) -> Result<(), PageError>
pub async fn finish(self) -> Result<(), PageError>
Commits the read-only transaction and releases its pooled connection.
§Errors
Returns a database error if committing the read transaction fails. A lost commit response does not establish whether the server committed.
Auto Trait Implementations§
impl !RefUnwindSafe for SnapshotPager
impl !Send for SnapshotPager
impl !Sync for SnapshotPager
impl !UnwindSafe for SnapshotPager
impl Freeze for SnapshotPager
impl Unpin for SnapshotPager
impl UnsafeUnpin for SnapshotPager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more