Open dwmunster opened 5 years ago
If you're amenable, I can throw together a PR for this.
Yes, I think this addition is a good new feature. You still want to submit a PR for this @dwmunster ? I have more time to work on features and review PRs in the next two weeks. Let me know if you don't have the time right now so I will give it a shot :)
Sorry for taking a while to respond @fgrosse, I've gotten quite busy these past couple weeks. I should have time to put something together this weekend if you'd like. If you'd like it done before then, have at.
Summary
Since many uses of the
Storage
interface may have hierarchical keys, e.g. the permissions, it would be beneficial to have a way to iterate over keys matching a given prefix.Basic example
Motivation
From #28
Rather than push this onto any developer who needs to interact with the permissions, we could require the
Storage
interface to support prefix scans. Some storage engines may have a higher performance way of doing prefix scans and we could take advantage of that. If the storage engine does not offer it, the bot could handle the naive looping over keys itself. This removes the burden from developers to implement/test this independently.Potential Issues
Storage
interface, a new release would break any third party implementations. As described above, this would not be an issue.