File tree Expand file tree Collapse file tree 2 files changed +28
-13
lines changed
Expand file tree Collapse file tree 2 files changed +28
-13
lines changed Original file line number Diff line number Diff line change 1+ # ` DelPattern `
2+
3+ The core quamina.Matcher doesn't currently support deleting patterns.
4+ Some of the contemplated implementations of would probably be pretty
5+ difficult. At least one approach is pretty easy: Wrap the current
6+ matcher to filter removed patterns from match results and periodically
7+ rebuild the matcher from scrach with the live patterns. More
8+ specifically:
9+
10+ 1 . Remember patterns that have been added
11+ 2 . Remember patterns that have been removed (implicitly)
12+ 3 . Filter ` MatchesFor...() ` results to remove any removed patterns
13+ 4 . Rebuilding the matcher state periodically with only the live
14+ patterns
15+ 5 . Maintain some statistics to help decide when to rebuild
16+
17+ The implementation of the set of live patterns is pluggable via a Go
18+ interface (` State ` ). The default implementation ` MemState ` is just a
19+ ` map[quamina.X]string ` . Other implementations could provide
20+ persistence.
21+
22+ By default, rebuilding is triggered automatically (synchronously
23+ currently) during mutations. You can also force a manual ` Rebuild() ` ,
24+ and you can ` DisableRebuild() ` to prevent any automation rebuilds.
25+ The code also supports pluggable rebuilding policies, but those
26+ features are not currently exposed.
27+
Original file line number Diff line number Diff line change 55// probably be pretty difficult. At least one approach is pretty
66// easy: Wrap the current matcher to filter removed patterns from
77// match results and periodically rebuild the matcher from scrach with
8- // the live patterns. More specifically:
9- //
10- // 1. Remember patterns that have been added
11- // 2. Remember patterns that have been removed (implicitly)
12- // 3. Filter MatchedFor...() results to remove any removed patterns
13- // 4. Support rebuilding the matcher state periodically with only the
14- // live patterns.
15- // 5. Maintain some statistics to help decide when to rebuild
16- //
17- // The implementation of the set of live patterns is pluggable via a
18- // Go interface (State). The default implementation is a
19- // `map[quamina.X]string (MemState)`. Other implementations can
20- // provide persistence.
8+ // the live patterns.
219//
2210// By default, rebuilding is triggered automatically (synchronously
2311// currently) during mutations. The code also supports pluggable
You can’t perform that action at this time.
0 commit comments