-
Notifications
You must be signed in to change notification settings - Fork 0
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
Subleveldown is now unnecessary, and it can be replaced with keypaths #12
Conversation
The When using the domain path, we now have to consider what is the user trying to do. // this means sublevel of A then B
await db.iterator(options, ['A', 'B']);
// does this mean sublevel of A, or just A the key?
// it has to be sublevel of A obviously, since if the key is the only thing, then use the options parameter
await db.iterator(options, ['A']);
// does this mean get A the key?
// or does it mean get A the sublevel?
// it would have to mean A the key, since you cannot get a sublevel
await db.get(['A']);
await db.get(['A', 'B']); This means we should differentiate A A |
Therefore:
We can get rid of batch since that's done by |
Might prefer |
Additionally we can say |
We now have:
This allows us to get rid of |
The default separator is changed If we were really intending to allow sublevels to be arbitrary buffers, we would also need to do escaping. But this complicates things in DB iteration, and possibly one was to use order-preserving base encoding on all sublevels to avoid that one character of For now buffers can be used in level paths, but cannot be arbitrary buffers, or at least cannot contain the separator buffer of |
In the process of reworking the |
This test is now no longer relevant and is removed:
|
We will need https://www.typescriptlang.org/tsconfig/#stripInternal as I now have "internal methods" that are shared between https://stackoverflow.com/questions/45847399/friend-class-in-typescript |
ab65888
to
aa51544
Compare
aa51544
to
d4fd1d7
Compare
This is ready to be merged now. All tests pass, and benchmarks have been re-ran. The dependencies have been significantly pruned here. |
Description
By getting rid of subleveldown, the API of DB changes quite significantly but also much more simpler:
Firstly we won't have to deal with creating sublevels in an inefficient way: #11 (comment). Instead we just do everything through key concatenation.
We still need a separator which we can preserve as
!
as the default.For iteration, we would need to use #11 (comment)
This also means all downstream packages that use
DB
will only just use theDB
instance, they don't bother creating sublevel instances for no reason. There's no need to keep around sublevel instances anymore. This also reduces one headache which is that you have to "recreate" the sublevels whenever you stop the underlying database.See how in our
destroy
methods such asSessionManager
it requires:That's just unnecessary now.
You can just do:
This will probably mean a change to how we do our db domains, we just need to keep track of the levels we are operating on and that's it.
Issues Fixed
Tasks
KeyPath
andLevelPath
iterator
to be synchronous for bothDBTransaction
andDB
Final checklist