For abstraction purposes, it would be nice to have support for nested transactions.
I started an implementation, however, it’s not as easy as it looks at the first glance. LMDB will not allow nesting a RO transaction to a RW transaction.
That means that you cannot get an MDBROTransaction from an MDBRWTransaction.
This is unfortunate, because that means whenever a function takes an MDBROTransaction as argument, it can never ever be used within an MDBRWTransaction, even though that would be perfectly fine to do, semantically.
One workaround I was thinking of would be to make MDBRWTransaction inherit from MDBROTransaction, but then one would have to do the same for the cursor classes and make getROCursor virtual to perform proper cursor cleanup in the case of a MDBRWTransaction.
I’m not sure how this can be solved cleanly, if you’ve got any input, I’d appreciate that. For RW transactions, I have nesting implemented, and it seems to work great.
For abstraction purposes, it would be nice to have support for nested transactions.
I started an implementation, however, it’s not as easy as it looks at the first glance. LMDB will not allow nesting a RO transaction to a RW transaction.
That means that you cannot get an MDBROTransaction from an MDBRWTransaction.
This is unfortunate, because that means whenever a function takes an MDBROTransaction as argument, it can never ever be used within an MDBRWTransaction, even though that would be perfectly fine to do, semantically.
One workaround I was thinking of would be to make MDBRWTransaction inherit from MDBROTransaction, but then one would have to do the same for the cursor classes and make getROCursor virtual to perform proper cursor cleanup in the case of a MDBRWTransaction.
I’m not sure how this can be solved cleanly, if you’ve got any input, I’d appreciate that. For RW transactions, I have nesting implemented, and it seems to work great.