Struct ultra_batch::BatchFetcherBuilder
source · pub struct BatchFetcherBuilder<F>{ /* private fields */ }
Expand description
Used to configure a new BatchFetcher
. A BatchFetcherBuilder
is
returned from BatchFetcher::build
.
Implementations§
source§impl<F> BatchFetcherBuilder<F>
impl<F> BatchFetcherBuilder<F>
sourcepub fn delay_duration(self, delay: Duration) -> Self
pub fn delay_duration(self, delay: Duration) -> Self
The maximum amount of time the BatchFetcher
will wait to queue up
more keys before calling the Fetcher
.
sourcepub fn eager_batch_size(self, eager_batch_size: Option<usize>) -> Self
pub fn eager_batch_size(self, eager_batch_size: Option<usize>) -> Self
The maximum number of keys to wait for before eagerly calling the
Fetcher
. A value of Some(n)
will load the batch once n
or more
keys have been queued (or once the timeout set by
delay_duration
is reached,
whichever comes first). A value of None
will never eagerly dispatch
the queue, and the BatchFetcher
will always wait for the timeout set
by delay_duration
.
Note that eager_batch_size
does not set an upper limit on the
batch! For example, if BatchFetcher::load_many
is called with more
than eager_batch_size
items, then the batch will be sent immediately
with all of the provided keys.
sourcepub fn label(self, label: impl Into<Cow<'static, str>>) -> Self
pub fn label(self, label: impl Into<Cow<'static, str>>) -> Self
Set a label for the BatchFetcher
. This is only used to improve
diagnostic messages, such as log messages.
sourcepub fn finish(self) -> BatchFetcher<F>
pub fn finish(self) -> BatchFetcher<F>
Create and return a BatchFetcher
with the given options.