-
Notifications
You must be signed in to change notification settings - Fork 21
Description
I'd like to have the option, specified in the dora config file, to store leases in memory rather than using sqlite directly.
This could be added in multiple stages, the first one being the option to exclusively store leases in memory and not persist them at all. A future change could store leases in-memory and then persist them also to the db or a file in append-only mode.
I have experimented with a few crates for storing IPs. A few options come to mind:
- probably more traditional, a compressed prefix trie. I've used this library before and it's pretty efficient, supports IPv4 and IPv6 https://docs.rs/ip_network_table-deps-treebitmap/latest/ip_network_table_deps_treebitmap/
- roaring bitmap https://docs.rs/roaring/latest/roaring/bitmap/struct.RoaringBitmap.html uses a compression scheme to store many numbers efficiently
The roaring bitmap might not work for IPv6. I'd be curious to see a comparison of how much memory it takes to store a bunch of IPs in both. one sparse and one dense comparison would be most useful.
After that, it would be cool to be able to change the allocation strategy. Right now we just increment. Might be interesting to be able to specify forward | reverse | random etc