-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
Recursive directory-creation within database creation #135
Comments
👍 |
It would be easy to implement this into LevelUP, however, considering a typo in the levelUP creation call will create the database-directory unexpectedly. IMHO throwing an error is the only way to not raise confusion and create a regression to possible applications. That is, we could simply do:
We could also accept an override flag creating the directories in case they are inexistent:
Objections? |
IMHO I'll create it anyway, with an inverted override flag:
But that's only personal taste. |
Yes, I understand the approach you're proposing. But I'd rather target a change which would not change existing applications of the case (thus the non-inverted flag) — you can never estimate the impact of a change which maybe causing a regression. |
I'd say out of scope, throwing errors is ok and creating directories beforehand isn't complicated. What we could is catch that error, check if the given path doesn't exist and then print a nicer message. |
OK. Let's talk with the LevelDB guys about this. I started a discussion by creating an issue here. (Although I should have broken down the error-message to LevelDB-only.. copy and paste ftw) |
In the linked issue, you make it sound as if the node leveldb community is A feature like this makes zero sense for a production environment, and the Please consider updating the issue on google code to clarify that it is On Saturday, May 11, 2013, Kenan Sulayman wrote:
|
Actually, we're using this in production. Also, this was an issue; "waste of their time" is distracting. I'll update the issue accordingly, though. |
@KenanSulayman as you are using this in production, you can: levelup(mkdirp.sync("/path/to/nowhere/)) We can even put this solution as a FAQ in the readme. |
We're even using the mkdirp code [https://github.com/KenanSulayman/node-levelup/commit/84ef555306860186e02fdfb298f8745068a79801 Line 69+] as I implemented in (#136), your solution is far simpler.. but I already deployed the code :/ Thanks though! 👍 |
We should be aware of a case where a database is located in a location which is not existing in the first place.
Considering, we're trying to open a database:
whereas ./db/ is not existing.
A dubious error is thrown, but does not explain the allocation is invalid because the directory itself is not existing:
I propose a reverse-lookup of the directory-path (cherry-picking ftw) and either an error being thrown explaining the problem further or the directories to the target path being created recursively.
The text was updated successfully, but these errors were encountered: