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§
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