pub trait WebhookLog:
Send
+ Sync
+ 'static {
// Required methods
fn record<'a>(&'a self, event: &'a WebhookEvent) -> LogFuture<'a, bool>;
fn raw<'a>(&'a self, dedup_key: &'a str) -> LogFuture<'a, Option<Json>>;
fn withdraw<'a>(&'a self, dedup_key: &'a str) -> LogFuture<'a, ()>;
}Expand description
Where received events are recorded.
record must be atomic: two deliveries of one event racing each other
must see exactly one true. A read followed by a write leaves a window in
which both do, and both credit the customer. The database implementation
does it with a unique index and an insert; the memory one with a mutex.
Required Methods§
Sourcefn record<'a>(&'a self, event: &'a WebhookEvent) -> LogFuture<'a, bool>
fn record<'a>(&'a self, event: &'a WebhookEvent) -> LogFuture<'a, bool>
Record the event, returning whether this call was the first to. false
means it has been seen: hand it back as handled and do nothing else.
Sourcefn raw<'a>(&'a self, dedup_key: &'a str) -> LogFuture<'a, Option<Json>>
fn raw<'a>(&'a self, dedup_key: &'a str) -> LogFuture<'a, Option<Json>>
The raw body of a recorded event, for replay.
Sourcefn withdraw<'a>(&'a self, dedup_key: &'a str) -> LogFuture<'a, ()>
fn withdraw<'a>(&'a self, dedup_key: &'a str) -> LogFuture<'a, ()>
Forget an event whose handler failed, so the gateway’s retry is processed rather than dropped as a duplicate of something nothing handled. Without this, a handler that crashed once would have crashed forever as far as that payment is concerned.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".