pub struct DedupStore { /* private fields */ }Expand description
Deduplication store — hides the backing implementation behind a clean API.
Two variants are supported:
- In-memory (
new_in_memory): default, fastest, state lost on restart. - File-backed (
new_filebacked): persists to a file so dedup state survives process restarts (prevents re-processing of GitHub retries after a restart within the dedup window).
Implementations§
Source§impl DedupStore
impl DedupStore
Sourcepub fn new_in_memory_with_metrics(
window_secs: u64,
max_size: usize,
metrics_enabled: bool,
) -> Self
pub fn new_in_memory_with_metrics( window_secs: u64, max_size: usize, metrics_enabled: bool, ) -> Self
Create an in-memory dedup store with optional metrics.
Sourcepub fn new_filebacked_with_metrics(
path: PathBuf,
window_secs: u64,
max_size: usize,
metrics_enabled: bool,
) -> Self
pub fn new_filebacked_with_metrics( path: PathBuf, window_secs: u64, max_size: usize, metrics_enabled: bool, ) -> Self
Create a file-backed dedup store with optional metrics.
Sourcepub async fn check_and_insert(&self, delivery_id: &str) -> bool
pub async fn check_and_insert(&self, delivery_id: &str) -> bool
Check whether delivery_id is new and, if so, record it.
Returns true if the delivery is new (should be processed) or
false if it is a duplicate (should be silently ACKed).
Sourcepub async fn metrics(&self) -> DedupMetrics
pub async fn metrics(&self) -> DedupMetrics
Return a metrics snapshot (non-blocking).
pub fn metrics_enabled(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DedupStore
impl !UnwindSafe for DedupStore
impl Freeze for DedupStore
impl Send for DedupStore
impl Sync for DedupStore
impl Unpin for DedupStore
impl UnsafeUnpin for DedupStore
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> 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> ⓘ
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