pub struct IndexablePager { /* private fields */ }Expand description
Deterministic pager for IndexableSource.
Encapsulates shuffle seed and cursor math so callers can reuse a stable paging algorithm without implementing permutation logic themselves.
Implementations§
Source§impl IndexablePager
impl IndexablePager
Sourcepub fn new(source_id: impl Into<SourceId>) -> Self
pub fn new(source_id: impl Into<SourceId>) -> Self
Create a new deterministic pager for source_id.
Sourcepub fn refresh(
&self,
source: &dyn IndexableSource,
cursor: Option<&SourceCursor>,
limit: Option<usize>,
) -> Result<SourceSnapshot, SamplerError>
pub fn refresh( &self, source: &dyn IndexableSource, cursor: Option<&SourceCursor>, limit: Option<usize>, ) -> Result<SourceSnapshot, SamplerError>
Page records from an IndexableSource using the provided cursor.
Sourcepub fn refresh_with<F>(
&self,
total: usize,
cursor: Option<&SourceCursor>,
limit: Option<usize>,
fetch: F,
) -> Result<SourceSnapshot, SamplerError>
pub fn refresh_with<F>( &self, total: usize, cursor: Option<&SourceCursor>, limit: Option<usize>, fetch: F, ) -> Result<SourceSnapshot, SamplerError>
Page records using a custom index fetcher.
Useful when records are indexable but not exposed through IndexableSource
(for example, temporary index stores or precomputed path lists).
The fetcher is called concurrently using rayon. It must be Fn + Send + Sync
(not merely FnMut). All callers that pass a closure over a shared
&IndexableSource satisfy this because record_at takes &self.
Auto Trait Implementations§
impl Freeze for IndexablePager
impl RefUnwindSafe for IndexablePager
impl Send for IndexablePager
impl Sync for IndexablePager
impl Unpin for IndexablePager
impl UnsafeUnpin for IndexablePager
impl UnwindSafe for IndexablePager
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
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>
Converts
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>
Converts
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