Skip to main content

ReceiptLog

Trait ReceiptLog 

Source
pub trait ReceiptLog: Send + Sync {
    // Required method
    fn append(&self, receipt: &DownloadReceipt) -> Result<()>;
}
Expand description

Append-only sink for DownloadReceipts.

The trait exists so the voucher-accept path can be exercised against an in-memory fake in unit tests; the runtime uses JsonlReceiptLog. Implementations MUST be cheap enough to call inline on the delivery path (one buffered line write + flush — no fsync; see the module durability note).

Required Methods§

Source

fn append(&self, receipt: &DownloadReceipt) -> Result<()>

Durably-enough append one receipt (write + flush, no fsync).

§Errors

Returns the underlying std::io::Error if serialization or the write fails. The caller treats a receipt-log failure as non-fatal (the payment already advanced the lane watermark) and logs it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§