Struct ultra_batch::BatchExecutorBuilder
source · pub struct BatchExecutorBuilder<E>{ /* private fields */ }
Expand description
Used to configure a new BatchExecutor
. A BatchExecutorBuilder
is
returned from BatchExecutor::build
.
Implementations§
source§impl<E> BatchExecutorBuilder<E>
impl<E> BatchExecutorBuilder<E>
sourcepub fn delay_duration(self, delay: Duration) -> Self
pub fn delay_duration(self, delay: Duration) -> Self
The maximum amount of time the BatchExecutor
will wait to queue up
more keys before calling the Executor
.
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
Executor
. 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 BatchExecutor
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 BatchExecutor::execute_many
is called with
more than eager_batch_size
items, then the batch will be sent
immediately with all of the provided values.
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 BatchExecutor
. This is only used to improve
diagnostic messages, such as log messages.
sourcepub fn finish(self) -> BatchExecutor<E>
pub fn finish(self) -> BatchExecutor<E>
Create and return a BatchExecutor
with the given options.