-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failiable predicate in retain
and extract
#931
Comments
redb will only pass a value to |
That's something that I'm on a fence with. Technically the user of my code is free to implement their own de/en-coding for every type, I can't really force them to round-trip. And in principle the predicate might even have a reason to fail other then encoding/decoding. E.g. what if the decoding requires something that is fallible - let's say a look up in a persisted dictionary? So far I was able to expose the possibility of encoding issues in every API without much of a UX degradation, if few places exposing alternative APIs that just panic. In |
In |
I modeled the API after |
People are not going to do the exact same things with a map, as they do with a database. AFAICT, the way |
Could you collect a few real world use cases to motivate this, and write up the exact semantics that you'd like That'd help me evaluate whether it's makes sense to change it |
These two APIs take the control from the caller for indefinite time with no ability to influence it, and experience tells me that there will be uncommon, but real cases where that will be a problem. Real world use case? I don't know ... Lets say I have 1B (or rather: potentially very large number) keys to go through, the whatever computation on each might multiply the effect, and if the user/system requested a timeout, I'd like to abort immediately/prompty? I assume that the way Semantics would be just short-circuiting and bubbling the error out. Then the user can abort or commit, depending if the partial delete is better than none at all. |
ya, makes sense. I'll give it some thought, but am reluctant to complicate the API. To make it properly general I think the predicate would need to be It may be better to support advanced use cases like that with a mutable cursor API |
That sounds really powerful and would address use cases that the current APIs might not, so 👍 |
Since I'm working on a bincode wrapper, my predicate can (in theory) fail to decode key/value and then there's no way to bubble it up. All other APIs I've wrapped so far allowed me to bubble up internal encoding/decoding errors.
The text was updated successfully, but these errors were encountered: