DeletePattern
June 16, 2026 ยท View on GitHub
The core quamina.Matcher doesn't currently support deleting patterns. Some of the contemplated implementations would probably be pretty difficult. At least one approach is pretty easy: Wrap the current matcher to filter removed patterns from match results and periodically rebuild the matcher from scratch with the live patterns. More specifically:
- Remember patterns that have been added
- Remember patterns that have been removed (implicitly)
- Filter
MatchesFor...()results to remove any removed patterns - Rebuild the matcher state periodically with only the live patterns
- Maintain some statistics to help decide when to rebuild
The implementation of the set of live patterns is pluggable via a Go
interface (State). The default implementation MemState is just a
map[quamina.X]string. Other implementations could provide
persistence.
By default, rebuilding is triggered automatically (synchronously
currently) during mutations. You can also force a manual Rebuild(),
and you can DisableRebuild() to prevent any automatic rebuilds.
The code also supports pluggable rebuilding policies, but those
features are not currently exposed.