dnstapir / pop

DNS TAPIR Policy Processor
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Improve the Reaper logic #37

Open johanix opened 6 months ago

johanix commented 6 months ago

Currently, the ReaperData structure is a map[deletetime]map[name]bool. This is not convenient (because the map[deletetime] isn't sorted) when hunting for old slots that failed to get deleted when they should.

A likely better alternative would be to just store the ReaperData as a sorted []ReaperObject (for lack of a better name), where a ReaperObject has a ReaperTime (when to delete) and, again, a map[name]bool (set of names to delete). Adding to the ReaperData becomes just an append() and when running the reaper we just scan from the front and delete as long as the ReaperTime is in the past.