yl2chen / cidranger

Fast IP to CIDR lookup in Golang
MIT License
897 stars 105 forks source link

Custom Ranger Insert/Remove Hooks #45

Open jhg03a opened 2 years ago

jhg03a commented 2 years ago

Having the ability to supply custom insertion/removal function hooks would be really useful if the data being added was a complex object like a map/slice/struct where specific merge behavior could be specified. This is primarily for the use case where I'm inserting multiple times for the same network with different data as this prevents the need to buffer and merge before inserting into the trie.

jhg03a commented 2 years ago

The workaround I use today is to maintain a parallel lookup trie and map so I get the speed of lookups using the trie and maps, but the flexibility to handle merges myself on upserts.