pub struct TriggerToNodes { /* private fields */ }Expand description
Channel-to-node reverse mapping for efficient scheduling
When a channel (field) is updated, only the subscribed nodes need
to be checked, reducing scheduling from O(nodes) to O(triggered_nodes).
§Examples
ⓘ
use juncture_core::pregel::scheduler::TriggerToNodes;
let trigger_to_nodes = TriggerToNodes::from_trigger_table(&trigger_table);
let triggered = trigger_to_nodes.triggered_nodes(&["field_a".to_string()]);
assert!(triggered.contains("node_x"));Implementations§
Source§impl TriggerToNodes
impl TriggerToNodes
Sourcepub fn from_trigger_table<S: State>(table: &TriggerTable<S>) -> Self
pub fn from_trigger_table<S: State>(table: &TriggerTable<S>) -> Self
Build from the compiled TriggerTable
Constructs a reverse mapping from trigger source names to the set of nodes that subscribe to each source.
Sourcepub fn triggered_nodes(&self, updated_channels: &[String]) -> HashSet<String>
pub fn triggered_nodes(&self, updated_channels: &[String]) -> HashSet<String>
Given updated channel names, return the nodes that should be checked
Returns the union of all node sets subscribed to any of the given channels.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TriggerToNodes
impl RefUnwindSafe for TriggerToNodes
impl Send for TriggerToNodes
impl Sync for TriggerToNodes
impl Unpin for TriggerToNodes
impl UnsafeUnpin for TriggerToNodes
impl UnwindSafe for TriggerToNodes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more