-
Notifications
You must be signed in to change notification settings - Fork 949
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
enhance: adjust data stream from pouch pull api #1586
enhance: adjust data stream from pouch pull api #1586
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1586 +/- ##
==========================================
- Coverage 41.92% 37.95% -3.98%
==========================================
Files 270 275 +5
Lines 17635 19451 +1816
==========================================
- Hits 7394 7382 -12
- Misses 9333 11154 +1821
- Partials 908 915 +7
|
pkg/jsonstream/format.go
Outdated
@@ -23,46 +22,21 @@ var ( | |||
jsonSep = []byte(",") |
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.
jsonBeginDelim
, jsonEndDelim
and jsonSep
seems have been deprecated?
And the Formater
seems not appropriate as well 😄 . Only the Write
method of it is necessary.
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 will remove the jsonBeginDelim
, jsonEndDelim
, jsonSep
. Maybe the requirement is to render the array json to the caller. But for this case, we don't need the BeginWrite
function.
PullStatusExists = "exists" | ||
// PullStatusDone represents done status. | ||
PullStatusDone = "done" | ||
) |
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.
Maybe define a special type for these status? like type PullStatus string
?
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's const var. I think both are ok right now. If we need to upgrade the definition with format like progress.Bar
, we will use the specific type for the status. WDTY?
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.
Yes, agree.
Actually I'm not very skilled at this part 😄 , but apart from the minor issue mentioned above, LGTM. |
ctrd/image.go
Outdated
@@ -212,11 +203,13 @@ outer: | |||
} | |||
// update status of active entries! | |||
for _, active := range active { |
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.
maybe we should rename the later active as activities. It's a little misunderstanding
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.
Have updated
In order to help user migrate to PouchContainer from docker world, PouchContainer need to adjust data stream from pull image api so that the docker pull can consume PouchContainer data steam. Signed-off-by: Wei Fu <[email protected]>
@YaoZengzeng and @shaloulcy I have updated the code. PTAL |
LGTM |
LGTM |
Ⅰ. Describe what this PR did
Since the existing swarm, mesos or other scheduled system maybe use the docker client to pull image from PouchContainer, PouchContainer should change data stream to help user to use PouchContainer.
It can help user to migrate to PouchContainer from docker.
Ⅱ. Does this pull request fix one issue?
fixes #1579
Ⅲ. Describe how you did it
With original design, the PouchContainer uses the array as data packet in the stream. However, the docker client can only consume the json as one packet in the stream. Before this change, we will got the error like that:
In order to make it happen, we need to adjust data stream with one json object as packet.
Ⅳ. Describe how to verify it
Basically, we need to confirm the pouch cli does work well.
For the docker client,
Ⅴ. Special notes for reviews