pub struct BatchConfig {
pub batch_max_size: usize,
pub inactive_timeout: Duration,
pub buffer_duration: Duration,
pub max_retry_count: u32,
pub retry_delay: Duration,
pub max_pending_entries: usize,
}Expand description
Tuning knobs for a BatchSink, matching the field names (and defaults)
of APISIX’s batch-processor schema plus featherbit’s channel capacity.
Fields§
§batch_max_size: usizeMaximum entries per batch; reaching it triggers an immediate flush.
A value of 1 flushes every entry as it arrives, with no timers.
Default 1000.
inactive_timeout: DurationFlush the buffer when no new entry has arrived for this long. Default 5 seconds.
buffer_duration: DurationFlush the buffer when the oldest buffered entry is this old, even if
entries keep trickling in fast enough to reset inactive_timeout.
Default 60 seconds.
max_retry_count: u32How many times a batch is retried after its first failed flush before
being dropped. Default 0 (no retries).
retry_delay: DurationDelay between retry attempts. Default 1 second.
max_pending_entries: usizeCapacity of the channel between BatchSink::push and the background
task. When full, pushed entries are dropped with a warning.
Default 10_000.
Implementations§
Source§impl BatchConfig
impl BatchConfig
Sourcepub fn from_config(config: &HashMap<String, Value>) -> Result<Self, String>
pub fn from_config(config: &HashMap<String, Value>) -> Result<Self, String>
Parses the APISIX-shaped keys (batch_max_size, inactive_timeout,
buffer_duration, max_retry_count, retry_delay — seconds as
integers — and max_pending_entries) from a plugin config map, using
the defaults for absent keys.
Returns an error naming the offending key when a present value is not a non-negative integer.
Trait Implementations§
Source§impl Clone for BatchConfig
impl Clone for BatchConfig
Source§fn clone(&self) -> BatchConfig
fn clone(&self) -> BatchConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BatchConfig
impl Debug for BatchConfig
Auto Trait Implementations§
impl Freeze for BatchConfig
impl RefUnwindSafe for BatchConfig
impl Send for BatchConfig
impl Sync for BatchConfig
impl Unpin for BatchConfig
impl UnsafeUnpin for BatchConfig
impl UnwindSafe for BatchConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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