pub struct OffsetPagination { /* private fields */ }Expand description
Stateful offset strategy with fixed page size and total metadata.
This type is intentionally neither Copy nor Clone.
Implementations§
Source§impl OffsetPagination
impl OffsetPagination
Sourcepub fn new(
first_offset: u64,
expected_page_size: u64,
budget: PaginationBudget,
) -> Result<Self, PaginationError>
pub fn new( first_offset: u64, expected_page_size: u64, budget: PaginationBudget, ) -> Result<Self, PaginationError>
Starts an offset traversal.
Sourcepub const fn next_offset(&self) -> Result<u64, PaginationError>
pub const fn next_offset(&self) -> Result<u64, PaginationError>
Returns the offset the caller must request next.
Sourcepub const fn progress(&self) -> PaginationProgress
pub const fn progress(&self) -> PaginationProgress
Returns accepted counters.
Sourcepub fn observe(
&mut self,
metadata: OffsetPageMetadata,
entries: usize,
rate_limit: Option<RateLimit>,
snapshot: Option<SnapshotId<'_>>,
) -> Result<OffsetPageBoundary, PaginationError>
pub fn observe( &mut self, metadata: OffsetPageMetadata, entries: usize, rate_limit: Option<RateLimit>, snapshot: Option<SnapshotId<'_>>, ) -> Result<OffsetPageBoundary, PaginationError>
Validates one response transactionally, then advances the strategy.
Trait Implementations§
Source§impl Debug for OffsetPagination
impl Debug for OffsetPagination
Source§impl PageStrategy for OffsetPagination
impl PageStrategy for OffsetPagination
Source§type Observation<'observation> = OffsetPageObservation<'observation>
type Observation<'observation> = OffsetPageObservation<'observation>
Decoded response observation, optionally borrowing provider state.
Source§type Boundary = OffsetPageBoundary
type Boundary = OffsetPageBoundary
Validated accepted page boundary.
Source§fn next_request(&self) -> Result<Self::Request, PaginationError>
fn next_request(&self) -> Result<Self::Request, PaginationError>
Returns the next request token or
PaginationError::Complete.Source§fn observe<'observation>(
&mut self,
observation: Self::Observation<'observation>,
) -> Result<Self::Boundary, PaginationError>
fn observe<'observation>( &mut self, observation: Self::Observation<'observation>, ) -> Result<Self::Boundary, PaginationError>
Transactionally validates and accepts one response.
Auto Trait Implementations§
impl Freeze for OffsetPagination
impl RefUnwindSafe for OffsetPagination
impl Send for OffsetPagination
impl Sync for OffsetPagination
impl Unpin for OffsetPagination
impl UnsafeUnpin for OffsetPagination
impl UnwindSafe for OffsetPagination
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
Mutably borrows from an owned value. Read more