Conversation
ef59c6a to
3f0470a
Compare
client/image_push.go
Outdated
| "github.com/moby/moby/client/pkg/jsonmessage" | ||
| ) | ||
|
|
||
| type PushMessage = jsonmessage.JSONMessage |
There was a problem hiding this comment.
could declare additional attributes to handle Aux raw message decoding, which are specific to push; This could avoid use of WithAuxCallback by client, having to guess the actual message types
There was a problem hiding this comment.
Oh, possibly! This was really a quick "let's see if this would work".
I had to run out for an appointment, but will play a bit with this later.
Overall, I like what it looks like (and would indeed allow us to differentiate responses instead of "everything is a json-message".
Also; feel free to play with it yourself!
There was a problem hiding this comment.
Pushed a quick commit to also try to make the Aux field strong typed; unit-tests looks happy, but probably could add some more to actually use the aux-message part.
|
I wonder we could refactor |
180bea4 to
174b59c
Compare
| func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error { | ||
| func DisplayJSONMessagesStream[A any](in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage[A])) error { |
There was a problem hiding this comment.
We could possibly internalise this if we want to keep the old signature (roughly); still need to look if we still need these, or if they need to be rewritten.
6165701 to
5b6e6cb
Compare
| ID string `json:"id,omitempty"` | ||
| Error *jsonstream.Error `json:"errorDetail,omitempty"` | ||
| Aux *json.RawMessage `json:"aux,omitempty"` // Aux contains out-of-band data, such as digests for push signing and image id after building. | ||
| Aux *A `json:"aux,omitempty"` // Aux contains out-of-band data, such as digests for push signing and image id after building. |
There was a problem hiding this comment.
using the /imageBuild API, aux is raw base64 string during the build but eventually build result with id=moby.image.id and aux as a struct with ID field, so we can't use a single type Aux for the whole operation
925af2e to
6c1feac
Compare
This allows for a strict type to be used for different endpoints. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
6c1feac to
2b0c3d4
Compare
Uh oh!
There was an error while loading. Please reload this page.