pub struct CacheDirectPusher<P> { /* private fields */ }Expand description
Pusher wrapper that buffers chunks and flushes large contiguous runs without merging.
Out-of-order chunks are stored in a BTreeMap. When a contiguous run reaches
the high watermark, it is flushed to the inner pusher as-is (no byte merging).
This reduces CPU overhead compared to super::CacheMergePusher at the cost of
more individual write calls.
Implementations§
Source§impl<P: Pusher> CacheDirectPusher<P>
impl<P: Pusher> CacheDirectPusher<P>
Sourcepub const fn new(inner: P, high_watermark: usize, low_watermark: usize) -> Self
pub const fn new(inner: P, high_watermark: usize, low_watermark: usize) -> Self
Wrap inner with the given high_watermark / low_watermark (in bytes).
Eviction to the inner pusher triggers once the buffered size reaches
high_watermark, and stops once it falls back to low_watermark.
low_watermark must not exceed high_watermark. A larger low_watermark
makes high_watermark irrelevant, because eviction does nothing until the
buffered size passes low_watermark, which then acts as the sole watermark.
With high_watermark == low_watermark, a push that lands the buffered size
exactly on the watermark evicts nothing; the next push takes it above and
eviction proceeds as usual.