1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! The two shape traits the engine implements and apps depend on (SPEC §7).
//!
//! These define the SHAPE of emit + catch-up without any machinery: [`EventEmitter`] is what the
//! engine's event bus offers to producers, and [`CatchUp`] is what a subscriber calls once after a
//! gap to backfill the missed range before resuming the live stream. The concrete bus, persisted
//! delta store, and live subscription streams live in the engine (dig-wallet-backend) — this crate
//! only fixes the interface so a second implementation is interchangeable.
use async_trait;
use EnumSet;
use crate;
use crateWalletEvent;
use crateEventKind;
/// A sink that accepts emitted events and stamps each with a monotonic [`Cursor`].
///
/// The engine implements this over its event bus; a producer calls [`publish`](EventEmitter::publish)
/// and gets back the cursor the event was assigned (so it can correlate or persist a checkpoint).
/// The backfill half of the subscription contract: a subscriber that fell behind calls this ONCE to
/// fetch the events it missed, then resumes the live stream.
///
/// The associated [`Error`](CatchUp::Error) type is generic so this leaf crate needs no error
/// dependency — the engine picks its own error type when it implements the trait.
/// Retain only the [`EmittedEvent`]s whose event kind passes `filter`, preserving cursor order.
///
/// The shared, drift-free filtering rule used on BOTH sides: the engine narrows a live stream with
/// it, and a [`CatchUp`] implementer applies the same rule to its backfill so live and catch-up
/// deliver an identical filtered view.