Get all enabled triggers for a (tenant, collection) matching an event. Returns triggers sorted by (priority, name) — deterministic execution order.
(
&self,
tenant_id: u64,
collection: &str,
event: DmlEvent,
)
| 134 | /// |
| 135 | /// Returns triggers sorted by (priority, name) — deterministic execution order. |
| 136 | pub fn get_matching( |
| 137 | &self, |
| 138 | tenant_id: u64, |
| 139 | collection: &str, |
| 140 | event: DmlEvent, |
| 141 | ) -> Vec<StoredTrigger> { |
| 142 | let map = match self.by_collection.read() { |
| 143 | Ok(m) => m, |
| 144 | Err(p) => p.into_inner(), |
| 145 | }; |
| 146 | let key = (tenant_id, collection.to_string()); |
| 147 | match map.get(&key) { |
| 148 | Some(list) => list |
| 149 | .iter() |
| 150 | .filter(|t| t.enabled && matches_event(t, event)) |
| 151 | .cloned() |
| 152 | .collect(), |
| 153 | None => Vec::new(), |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /// Replace the entire in-memory trigger map with `rows`. |
| 158 | /// Used by the catalog recovery sanity checker to repair |