pub struct CaptureRing { /* private fields */ }Expand description
Bounded ring buffer of captures. Cheap to clone the Arc around it; interior-mutable so the
capture module can insert through a shared &self.
Implementations§
Source§impl CaptureRing
impl CaptureRing
Sourcepub fn new(capacity: usize, max_bytes: usize, ttl: Duration) -> Self
pub fn new(capacity: usize, max_bytes: usize, ttl: Duration) -> Self
Create a ring bounded by capacity entries, max_bytes total, and ttl age.
Sourcepub fn insert(&self, req: CapturedRequest)
pub fn insert(&self, req: CapturedRequest)
Insert (or replace) the capture for its request_id. Evicts expired entries first, then the
oldest while over the count/byte budget — but never the just-inserted newest.
Sourcepub fn take(&self, request_id: &str) -> Option<CapturedRequest>
pub fn take(&self, request_id: &str) -> Option<CapturedRequest>
Remove and return the capture for request_id, if still present (not yet evicted). Called by
the verdict-join on a denied request.
Auto Trait Implementations§
impl !Freeze for CaptureRing
impl RefUnwindSafe for CaptureRing
impl Send for CaptureRing
impl Sync for CaptureRing
impl Unpin for CaptureRing
impl UnsafeUnpin for CaptureRing
impl UnwindSafe for CaptureRing
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