Registers `hash` under every key in `watch`. If `hash` is already present its previous watch set is removed first, so the index always reflects the latest registration. Returns `true` if this was a fresh insertion (i.e. the hash was not previously registered).
(&mut self, hash: TxHash, watch: WatchSet)
| 210 | /// latest registration. Returns `true` if this was a fresh insertion (i.e. |
| 211 | /// the hash was not previously registered). |
| 212 | pub fn insert(&mut self, hash: TxHash, watch: WatchSet) -> bool { |
| 213 | let was_present = self.remove(&hash).is_some(); |
| 214 | for key in watch.keys() { |
| 215 | self.by_key.entry(*key).or_default().insert(hash); |
| 216 | if let InvalidationKey::ExpiryBucket(bucket) = key { |
| 217 | self.expiry_buckets.insert(*bucket); |
| 218 | } |
| 219 | } |
| 220 | self.watch_sets.insert(hash, watch); |
| 221 | !was_present |
| 222 | } |
| 223 | |
| 224 | /// Removes `hash` from the index, unlinking it from each of its watched |
| 225 | /// keys and pruning any key bucket left empty. Returns the transaction's |