This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Require deferredOpen support #84
Labels
Comments
vweevers
changed the title
Require deferredOpen support and remove open hook
Require deferredOpen support
Oct 20, 2019
The following cases will become illegal. Creating a sublevel on a closed db db.close(function (err) {
subdb(db, 'example').on('error', function (err) {
throw err // Error: Parent database is not open
})
}) Creating a sublevel on a closing db / Closing a db while sublevel is opening subdb(db, 'example').on('error', (err) => {
throw err // Error: Parent database is not open
})
db.close(function () {}) |
vweevers
added a commit
that referenced
this issue
Apr 4, 2020
DeferredOpen means that the db opens itself and defers operations until it's open. Currently that's only supported by level(up) and friends. Before, subleveldown would also accept abstract-leveldown db's that were not wrapped in levelup. Opening and closing a sublevel no longer opens or closes the parent db. The sublevel does wait for the parent to open (which in the case of levelup already happens automatically) but never initiates a state change. Drops support of old modules: - memdb (use level-mem instead) - deferred-leveldown < 2.0.0 (and thus levelup < 2.0.0) - abstract-leveldown < 2.4.0 Closes #84, #83 and #60.
vweevers
added a commit
that referenced
this issue
Apr 4, 2020
DeferredOpen means that the db opens itself and defers operations until it's open. Currently that's only supported by level(up) and friends. Before, subleveldown would also accept abstract-leveldown db's that were not wrapped in levelup. Opening and closing a sublevel no longer opens or closes the parent db. The sublevel does wait for the parent to open (which in the case of levelup already happens automatically) but never initiates a state change. Drops support of old modules: - memdb (use level-mem instead) - deferred-leveldown < 2.0.0 (and thus levelup < 2.0.0) - abstract-leveldown < 2.4.0 Closes #84, #83 and #60.
vweevers
added a commit
that referenced
this issue
Apr 5, 2020
DeferredOpen means that the db opens itself and defers operations until it's open. Currently that's only supported by levelup (and levelup factories like level). Previously, subleveldown would also accept abstract-leveldown db's that were not wrapped in levelup. Opening and closing a sublevel no longer opens or closes the parent db. The sublevel does wait for the parent to open (which in the case of levelup already happens automatically) but never initiates a state change. If one closes the parent but not the sublevel, subsequent operations (like get and put) on the sublevel will yield an error, to prevent segmentation faults from underlying stores. Drops support of old modules: - memdb (use level-mem instead) - deferred-leveldown < 2.0.0 (and thus levelup < 2.0.0) - abstract-leveldown < 2.4.0 Closes #84, #83 and #60.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
To simplify the open/close handling on sublevels (and fix issues like #60) I propose the following.
levelup
, in the future alsoabstract-leveldown
). Insubleveldown
we then never open or close the parent db. More precisely: we never initiate a state change. The parent db must open itself (or once closed by the user, be explicitly reopened by the user) because sublevels shouldn't touch (the state of) the rest of the db.subdown._open()
wait for anopen
event of the parent db. It would be nice to not have an_open()
method at all, i.e. sublevels not having to care about whether the db is open, because deferredOpen support means you can always do operations on it, but this currently can't work because we operate on an unwrapped db. Whenabstract-leveldown
gets deferredOpen support, things will get better.The text was updated successfully, but these errors were encountered: