https://bugs.openldap.org/show_bug.cgi?id=9188
Bug ID: 9188 Summary: Expose transaction mt_flags? Product: LMDB Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: liblmdb Assignee: bugs@openldap.org Reporter: code@doriantaylor.com Target Milestone: ---
Created attachment 631 --> https://bugs.openldap.org/attachment.cgi?id=631&action=edit patch in mdb_txn_flags
I have taken over maintenance of the Ruby bindings to LMDB (https://github.com/doriantaylor/lmdb/tree/reconcile-2.7) and am currently fleshing out the transaction code. What I am finding is something of a leaky abstraction: in the current configuration it is essentially too easy to write Ruby code that messes up the internal transaction bookkeeping of the binding.
I am still trying to get my bearings on both the binding and the LMDB library itself, but it seems it would be generally useful if it was possible to determine whether a given transaction was read-only, so for example to prevent one from opening a read-write transaction beneath a read-only one.
As such, I propose the enclosed patch that adds an `mdb_txn_flags` function, which returns the `mt_flags` field. This would enable downstream developers to tell if a given transaction was, among other things, read-only, and behave accordingly.