pub struct SettleBuffer { /* private fields */ }Expand description
Coalesces bursty filesystem events into settled batches.
The daemon’s file watcher produces a storm of events during builds. The settle buffer absorbs them and waits for a quiet period (the settle window) before emitting a single batch. This prevents the cache from doing redundant work during a burst.
Implementations§
Source§impl SettleBuffer
impl SettleBuffer
Sourcepub fn new(settle_window: Duration) -> Self
pub fn new(settle_window: Duration) -> Self
Create a settle buffer with the given settle window and max wait.
Sourcepub fn default_window() -> Self
pub fn default_window() -> Self
Create a settle buffer with the default 50ms settle window.
Sourcepub async fn run(
&self,
rx: UnboundedReceiver<WatchEvent>,
tx: UnboundedSender<SettledEvent>,
)
pub async fn run( &self, rx: UnboundedReceiver<WatchEvent>, tx: UnboundedSender<SettledEvent>, )
Run the settle loop.
Reads raw WatchEvents from rx, coalesces them, and sends
SettledEvents to tx after each settle window elapses.
Returns when the input channel is closed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SettleBuffer
impl RefUnwindSafe for SettleBuffer
impl Send for SettleBuffer
impl Sync for SettleBuffer
impl Unpin for SettleBuffer
impl UnsafeUnpin for SettleBuffer
impl UnwindSafe for SettleBuffer
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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