-
Notifications
You must be signed in to change notification settings - Fork 50
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
Bring @masylum PR and @diasdavid PR to be a PR from a ipfs/js-ipfs-repo branch to master #2
Conversation
Read/Write the version number of that repository. | ||
|
||
```js | ||
repo.version().read(function (err, num) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any specific reason why version()
has to be a func?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was easier to develop but we can indeed have a better API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm "injecting" the store on each of those (https://github.com/ipfs/js-ipfs-repo/pull/2/files#diff-1fdf421c05c1140f6d71444ea2b27638R36). I can improve that I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a load
method, so that we can have a pre state where we can check if a repo exists, but without loading some of the variables to memory (things like version or config that can be read once), and also start the remaining stores, avoiding the need to have inject the 'store' for each call :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better. Any reason why is this not in the constructor?
*/ | ||
readWithoutLock: function (key, cb) { | ||
return this.read(key, cb) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that I'm not fully sure about. Should the locks be on the API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we will want to use it directly, but won't hurt having them available/thought through :)
module.exports = { | ||
version: require('./version'), | ||
config: require('./config'), | ||
// logs: require('./logs'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those are meant to disappear from the repos
I'm going to merge this and publish to npm, so that we can start jsipfs with a good precedent of having tests passing on travis, as we ship items from the Roadmap ipfs/team-mgmt#71 |
Bring @masylum PR and @diasdavid PR to be a PR from a ipfs/js-ipfs-repo branch to master
Makes contribution easier :)