verement / lmdb-simple

Simple Haskell API for LMDB
https://hackage.haskell.org/package/lmdb-simple
BSD 3-Clause "New" or "Revised" License
12 stars 11 forks source link

Convert a ReadWrite environment to a ReadOnly environment #1

Closed mihaigiurgeanu closed 6 years ago

mihaigiurgeanu commented 6 years ago

In an application, it would be useful to have 2 views of the same environment, on ReadOnly environment and another ReadWrite environment. In this way, the parts of the application needing only ReadOnly operations will take a ReadOnly environment and the compiler will make sure that those parts of the application will only do read only operations on the environment.

So, it would be useful to have a simple operation that will create an Environment ReadOnly out of an Environment ReadWrite. It would be the same environment, but it will be marked as ReadOnly so the compiler will only allow readonly operations on it.

verement commented 6 years ago

Thanks for the suggestion. I’ve implemented it in 865fa0de72497cef369146b5b969ca4d638794a7 for v0.4.0.0.