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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Actionable event API for strategy and automation consumption.
//!
//! Strategies use [`ActionableEventSource::subscribe_to_actionable_events`] to obtain
//! a unified stream of every event that may trigger an automated node action.
//!
//! ## Event filtering
//!
//! Pass `Some(&[ActionableEventDiscriminant::Ticket])` to avoid activating source
//! streams your strategy does not need. `None` subscribes to all sources.
use BoxStream;
use crate::;
/// Unified event type for strategy consumption.
///
/// Every event a strategy may react to is represented as a variant here.
///
/// The stream is **unfiltered** — strategies receive events for all channels
/// and all peers, not only those involving the local node. A strategy that
/// only cares about its own channels can filter with `channel.direction(&me)`
/// locally.
///
/// Use [`ActionableEventDiscriminant`] (derived via `strum::EnumDiscriminants`) to
/// declare which event sources a strategy needs when calling
/// [`ActionableEventSource::subscribe_to_actionable_events`].
/// Provides a merged stream of all actionable node events.
///
/// This trait is implemented by a HOPR node and gives strategies a single
/// subscription point that unifies on-chain events, network connectivity events,
/// and ticket pipeline events.
///
/// Each call to [`subscribe_to_actionable_events`] returns an **independent**
/// stream backed by its own broadcast receiver, so multiple concurrent
/// strategies each receive every event without interfering with each other.
///
/// ## Filtering
///
/// Pass `Some` discriminants to skip sources the strategy does not need.
/// Unneeded sources are never activated and consume no resources.
/// Pass `None` to subscribe to all sources (default for backward compatibility).
///
/// [`subscribe_to_actionable_events`]: ActionableEventSource::subscribe_to_actionable_events