Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Feat/cli progress bar #1036

Merged
merged 11 commits into from
Oct 19, 2017
Merged

Feat/cli progress bar #1036

merged 11 commits into from
Oct 19, 2017

Conversation

dryajov
Copy link
Member

@dryajov dryajov commented Oct 10, 2017

this includes changes from #994

@dryajov
Copy link
Member Author

dryajov commented Oct 10, 2017

This PR changes the behavior of files.add considerably as it switches to a chunked response (stream of objects) that reports progress. One issue with this is that the response is streamed and it's not possible to report an error with a standard 500 code, since it's already been initiated with a 200 code. My current solution is to report an error as part of the stream of objects and catch it in the ProgressStream through stream, if an error object is detected ({Message: '', Code: #}) the stream emits the error, which should propagates correctly.

I'm not sure if this is the best approach and would be curious to know how Go handles it. Tagging @whyrusleeping and @Kubuxu for possible input.

@whyrusleeping
Copy link
Member

whyrusleeping commented Oct 10, 2017 via email

@dryajov
Copy link
Member Author

dryajov commented Oct 10, 2017

@whyrusleeping ah! Didn't know about those - but makes sense! Thanks!

@dryajov dryajov changed the title Feat/cli progress bar [WIP] Feat/cli progress bar Oct 12, 2017
@dryajov dryajov changed the title [WIP] Feat/cli progress bar Feat/cli progress bar Oct 12, 2017
@daviddias daviddias added the status/ready Ready to be worked label Oct 13, 2017
@dryajov
Copy link
Member Author

dryajov commented Oct 15, 2017

Coverage has gone down due to https://github.com/ipfs/js-ipfs/pull/1036/files#diff-dcaf16a1df33e0e8f40195e527b9294dR244, but I don't see any tests that exercise that functionality directly. @diasdavid any ideas of how to tests this so that coverage goes up?

@daviddias daviddias added P0 Critical: Tackled by core team ASAP and removed status/ready Ready to be worked labels Oct 17, 2017
@ghost ghost assigned dryajov Oct 18, 2017
@ghost ghost added the status/in-progress In progress label Oct 18, 2017
prog(total)
}

options.progress = progress
pull(
pull.values(normalizeContent(data)),
importer(self._ipldResolver, options),
Copy link
Member Author

@dryajov dryajov Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diasdavid I noticed that there are two entry points for importer, here and above on line 26. The one above, gets called from the HTTP API, this one is called from the regular callback flow, they seem to be be doing exactly the same thing, perhaps we can replace this with a call to createAddPullStream and consolidate the progress accumulator logic there?

package.json Outdated
@@ -74,7 +74,7 @@
"expose-loader": "^0.7.3",
"form-data": "^2.3.1",
"gulp": "^3.9.1",
"interface-ipfs-core": "~0.31.19",
"interface-ipfs-core": "^0.32.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dryajov do not change ~ to ^, we use ~ until it gets to 1.0.0

@ghost ghost assigned daviddias Oct 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P0 Critical: Tackled by core team ASAP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants