Level / classic-level

An abstract-level database backed by LevelDB.
MIT License
58 stars 11 forks source link

Support for readonly mode #64

Closed rikmarais closed 1 year ago

rikmarais commented 1 year ago

It would be very helpful for our use case if classic-level were to support a readonly mode, where the database can be opened by multiple processes without compaction on startup, when those accessing the database do not need to make any changes.

There is an open issue for this feature on the upstream project already, though I believe that that project may be feature locked. I created this issue in the hopes that it may see some traction if such a feature is possible to implement on classic-level's level.

vweevers commented 1 year ago

It's not possible unless implemented upstream, because we have no control over the lock file.

The best we could do is prevent writes with a simple if (readonly) throw. Such a feature should take the preexisting readonly and readOnly options of rave-level and rocks-level into account (and align them). Could be done in abstract-level to make it work for any database. But, this approach has questionable value because it would not change the fact that the db is locked for exclusive (read) access.

So I'm closing this for now; I've subscribed to the upstream issue in case anything changes there.