|
StripeKit 0.1.1
Stripe integration toolkit for C++
|
A de-duplication store that keeps everything in memory. More...
#include <WebhookDedupStore.h>
Public Member Functions | |
| InMemoryWebhookDedupStore () | |
| Creates an empty store. | |
| ~InMemoryWebhookDedupStore () override | |
| Destroys the store instance. | |
| ClaimResult | claim (const ClaimRequest &request) override |
| Tries to reserve an event id for processing. | |
| bool | mark_processed (std::string_view event_id, std::chrono::system_clock::time_point processed_at) override |
| Records that an event has been fully handled. | |
| bool | release_claim (std::string_view event_id, std::chrono::system_clock::time_point claimed_at) override |
| Releases an unfinished claim after its handler has stopped. | |
| void | erase_expired (std::chrono::system_clock::time_point now, std::chrono::hours retention) override |
| Deletes records older than the retention period. | |
| Public Member Functions inherited from stripekit::WebhookDedupStore | |
| virtual | ~WebhookDedupStore ()=default |
| Destroys the store instance. | |
A de-duplication store that keeps everything in memory.
Suitable for tests and local development. It forgets everything when the process exits and is not shared between processes, so it is not appropriate for production.
Safe to use from several threads.
Definition at line 169 of file WebhookDedupStore.h.
| stripekit::InMemoryWebhookDedupStore::InMemoryWebhookDedupStore | ( | ) |
Creates an empty store.
|
override |
Destroys the store instance.
|
overridevirtual |
Tries to reserve an event id for processing.
| request | The event id to reserve, and the timing rules to apply. |
Implements stripekit::WebhookDedupStore.
|
overridevirtual |
Records that an event has been fully handled.
| event_id | The event id that was handled. |
| processed_at | When it finished. |
Implements stripekit::WebhookDedupStore.
|
overridevirtual |
Releases an unfinished claim after its handler has stopped.
Delete only the unprocessed record whose claim time matches claimed_at, so an older attempt cannot release a newer worker's reservation.
| event_id | The event to allow another delivery to retry. |
| claimed_at | The successful ClaimRequest::now for this attempt. |
| StripeKitException | The store could not release the claim. |
Implements stripekit::WebhookDedupStore.
|
overridevirtual |
Deletes records older than the retention period.
| now | Current time. |
| retention | How long a record must be kept. |
Implements stripekit::WebhookDedupStore.