-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support "deep" option in clear() & iterator() #85
Comments
okay, actually tested it; doesn't seem to: let db = levelup(encoding(memdown()));
let dbsub = sub(db, "foo");
let dbsubsub = sub(dbsub, "bar");
await dbsub.put("A", "a");
await dbsubsub.put("B", "b");
await dumpKeys(db);
await dbsub.clear();
await dumpKeys(db);
I guess I can work around it with something like: |
Clearing works the same as iterating (it visits the same keys). Should we forego that symmetry? |
probably not, but perhaps adding an option field? something like "all" to signal you want to clear everything? |
That might be nice for iterators too. |
Or "deep". A PR is welcome. |
but what would be the range? I just guessed that |
Looking more closely at this, iterators already include the keys of nested sublevels. Maybe you were hitting a race issue in opening the db? |
I fail to replicate #85 (comment). |
you're right; looks like the issue only arises when encoding-down is used - I tried to replicate in existing (subleveldown) test but couldn't, but it is only if I remove encoding-down from the code above, it clears properly. ... and I've tried to test that too ( |
dam... I think it might have been a bad version on my monorepo. I forced update to the latest versions and the issue seems to have vanished. Sorry... I thought had updated them all - but I think I had the last memdown major - sorry for wasting your time. |
I've not tested yet, but I'm suspecting that clear on a parent sub doesn't empty any nested subs?
The text was updated successfully, but these errors were encountered: