sled icon indicating copy to clipboard operation
sled copied to clipboard

MergeOperator returns result type

Open laudiacay opened this issue 3 years ago • 1 comments

Use Case:

Merges that can fail would be really useful- for example, I'm doing some deserialization of the ivecs before the merge which can fail.

Proposed Change:

have it return Result<Option<Vec>> and roll back the transaction if it's an Err

Who Benefits From The Change(s)?

Anyone that's doing merges that might not succeed, which i'd bet is a lot of people. sled's design seems to encourage having a parsing layer on top of storage- you have to store vecs of u8s... It seems weird not to have this be a result type.

Alternative Approaches

store some "failure" data in the db and then do a read to check whether it failed and then handle the situation in there... very ugly.

just use regular logic around regular database transaction :( but this merge functionality is so nice!

laudiacay avatar Feb 28 '22 02:02 laudiacay

one second, filling this out, my pinkie is messed up and i accidentally hit enter...

post-issue-writing edit: owie ouch. sorry for all the short phrases, i only have 3.5 fingers functioning properly on my right hand right now :| hope everything made sense

laudiacay avatar Feb 28 '22 02:02 laudiacay