CoreyKaylor / Lightning.NET

.NET library for LMDB key-value store
Other
398 stars 82 forks source link

[Suggestion] Surface return codes from Delete and Put #108

Closed AlgorithmsAreCool closed 4 years ago

AlgorithmsAreCool commented 6 years ago

Reading the lmdb docs i see that mdb_del returns MDB_NOTFOUND as an indicator that it could find a key to delete.

Similarly mdb_put will return MDB_KEYEXIST if there is already a key in the database.

These hints could be of use to clients and should be surfaced in the API.

If the maintainer thinks this is a good idea I could put a PR together to add this.

CoreyKaylor commented 4 years ago

I'm open to the changes, but I understand that you may not be motivated to help considering I've neglected the project for some time. My circumstances have changed, but I'll leave this open regardless as a reminder.

AlgorithmsAreCool commented 4 years ago

Oh wow, I moved on from using this package a while back. But i still think it is by far the easiest to use of the .NET LMDB wrappers. Thank you for writing it!

I'm pretty busy for the next few days, but i'll try to submit a simple PR.

CoreyKaylor commented 4 years ago

Upon looking into this request further. It looks like all code paths assert the return code and throw a LightningException that includes the status code.