pub struct InterceptStore { /* private fields */ }Expand description
Shared per-process intercept store.
Implementations§
Source§impl InterceptStore
impl InterceptStore
pub fn new() -> Self
Sourcepub fn register(
&self,
host: impl Into<String>,
method: impl Into<String>,
path: impl Into<String>,
) -> (u64, Receiver<InterceptDecision>)
pub fn register( &self, host: impl Into<String>, method: impl Into<String>, path: impl Into<String>, ) -> (u64, Receiver<InterceptDecision>)
Register a fresh intercept and return the receiver the request handler should await on, plus the assigned ID.
Each call also opportunistically GCs any senders whose receiver
has been dropped — this catches the client-disconnect path where
neither resolve nor the timeout’s cancel fires (the request
future is cancelled before either arm of tokio::select! runs).
Without the GC the entries leak forever in senders + pending.
Sourcepub fn gc_dead_senders(&self) -> usize
pub fn gc_dead_senders(&self) -> usize
Drop entries whose oneshot rx has been dropped. Exposed for tests + the TUI render loop, which can call this periodically even when no new intercepts are arriving.
Sourcepub fn resolve(&self, id: u64, decision: InterceptDecision) -> bool
pub fn resolve(&self, id: u64, decision: InterceptDecision) -> bool
Resolve a pending intercept with a decision. Idempotent — a second resolve for the same id is a no-op.
Sourcepub fn cancel(&self, id: u64) -> bool
pub fn cancel(&self, id: u64) -> bool
Cancel a pending intercept WITHOUT sending a decision. The proxy calls this when the receiver is dropped (client disconnected, request timed out before the operator decided) so the sender + pending entry don’t leak forever in the maps. Idempotent.
Returns true if an entry was removed, false if no such id.
Sourcepub fn drain_release(&self) -> usize
pub fn drain_release(&self) -> usize
Release every pending intercept with Release. Used when the
operator toggles intercept-mode OFF — don’t strand existing
requests.
Sourcepub fn snapshot(&self) -> Vec<PendingIntercept>
pub fn snapshot(&self) -> Vec<PendingIntercept>
Snapshot of the pending list for the TUI.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
How many requests are currently parked in the rendezvous.
Trait Implementations§
Source§impl Clone for InterceptStore
impl Clone for InterceptStore
Source§fn clone(&self) -> InterceptStore
fn clone(&self) -> InterceptStore
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 InterceptStore
impl Debug for InterceptStore
Source§impl Default for InterceptStore
impl Default for InterceptStore
Source§fn default() -> InterceptStore
fn default() -> InterceptStore
Auto Trait Implementations§
impl Freeze for InterceptStore
impl RefUnwindSafe for InterceptStore
impl Send for InterceptStore
impl Sync for InterceptStore
impl Unpin for InterceptStore
impl UnsafeUnpin for InterceptStore
impl UnwindSafe for InterceptStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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