pub struct LoaderConfig { /* private fields */ }Expand description
Limits for a Loader.
The defaults are intentionally conservative: 1,000 keys per batch is far more than an IN
query should carry, and the queue limit only exists so a resolver that issues an unbounded
number of loads in one tick cannot grow memory without bound.
Implementations§
Source§impl LoaderConfig
impl LoaderConfig
Sourcepub const fn with_max_batch_size(self, size: usize) -> Self
pub const fn with_max_batch_size(self, size: usize) -> Self
Set the maximum number of keys passed to one call of the batch function.
Zero is treated as one.
Sourcepub const fn with_max_queue(self, size: usize) -> Self
pub const fn with_max_queue(self, size: usize) -> Self
Set the maximum number of keys queued before a flush is forced.
When the queue reaches this length the loader starts batches immediately instead of waiting for the next poll. Zero is treated as one. This bounds work waiting for the batch window; results are still cached per key for the loader’s lifetime, so it is not a cap on the number of distinct keys a request may load.
Sourcepub const fn with_max_attempts(self, attempts: u8) -> Self
pub const fn with_max_attempts(self, attempts: u8) -> Self
Set how many times a key may be retried when a batch function omits its result.
This only matters if the batch function violates its contract. Zero is treated as one.
Sourcepub const fn max_batch_size(&self) -> usize
pub const fn max_batch_size(&self) -> usize
The maximum number of keys passed to one call of the batch function.
Sourcepub const fn max_attempts(&self) -> u8
pub const fn max_attempts(&self) -> u8
The maximum number of attempts for a key a batch function failed to answer.
Trait Implementations§
Source§impl Clone for LoaderConfig
impl Clone for LoaderConfig
impl Copy for LoaderConfig
Source§impl Debug for LoaderConfig
impl Debug for LoaderConfig
Source§impl Default for LoaderConfig
impl Default for LoaderConfig
impl Eq for LoaderConfig
Source§impl PartialEq for LoaderConfig
impl PartialEq for LoaderConfig
impl StructuralPartialEq for LoaderConfig
Auto Trait Implementations§
impl Forget for LoaderConfig
impl Freeze for LoaderConfig
impl Move for LoaderConfig
impl RefUnwindSafe for LoaderConfig
impl Send for LoaderConfig
impl Sync for LoaderConfig
impl Unpin for LoaderConfig
impl UnsafeUnpin for LoaderConfig
impl UnwindSafe for LoaderConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.