pub struct LifeloopReceiptEmitter<S: IdempotencyStore = InMemoryIdempotencyStore> { /* private fields */ }Expand description
Concrete ReceiptEmitter for issue #14.
Holds a sequence generator and an idempotency store. The
ReceiptEmitter::emit trait method takes a fully-built
LifecycleReceipt (the seam from issue #7) and validates +
idempotency-checks it. The richer
Self::synthesize_and_emit entry point consumes a
NegotiatedPlan + CallbackResponse + ReceiptContext and
builds the receipt before storing it — that is the path issue #14
is delivering.
Implementations§
Source§impl<S: IdempotencyStore> LifeloopReceiptEmitter<S>
impl<S: IdempotencyStore> LifeloopReceiptEmitter<S>
Sourcepub fn with_store(store: S) -> Self
pub fn with_store(store: S) -> Self
Construct an emitter with a caller-supplied store (e.g. a database-backed implementation in production).
pub fn store(&self) -> &S
pub fn sequencer(&self) -> &SequenceGenerator
Sourcepub fn synthesize_and_emit(
&self,
negotiated: &NegotiatedPlan,
response: &CallbackResponse,
ctx: &ReceiptContext,
) -> Result<LifecycleReceipt, ReceiptError>
pub fn synthesize_and_emit( &self, negotiated: &NegotiatedPlan, response: &CallbackResponse, ctx: &ReceiptContext, ) -> Result<LifecycleReceipt, ReceiptError>
Build, validate, and idempotency-check a receipt from a negotiation result + the client’s response.
Returns the canonical receipt (newly inserted, or the prior replay value when the same idempotency key is reused with the same content).
Trait Implementations§
Source§impl<S: Debug + IdempotencyStore> Debug for LifeloopReceiptEmitter<S>
impl<S: Debug + IdempotencyStore> Debug for LifeloopReceiptEmitter<S>
Source§impl<S: IdempotencyStore> ReceiptEmitter for LifeloopReceiptEmitter<S>
impl<S: IdempotencyStore> ReceiptEmitter for LifeloopReceiptEmitter<S>
Source§fn emit(&self, receipt: &LifecycleReceipt) -> Result<(), Self::Error>
fn emit(&self, receipt: &LifecycleReceipt) -> Result<(), Self::Error>
Validate + idempotency-check an externally-built
LifecycleReceipt. The richer
Self::synthesize_and_emit is the path issue #14 is
delivering; this trait method exists to satisfy the issue #7
seam contract for callers that already hold a built receipt.