Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.

Implementing backward compatibility for engine-api users #144

Open
nishanttotla opened this issue Mar 11, 2016 · 3 comments
Open

Implementing backward compatibility for engine-api users #144

nishanttotla opened this issue Mar 11, 2016 · 3 comments

Comments

@nishanttotla
Copy link
Contributor

Hi,

This is more of a question - I've been thinking about how to use the backward compatibility structs defined in https://github.com/docker/engine-api/tree/master/types/versions/. The older structs are implemented there, but the method signatures in the interface only refer to the latest ones.

What's the recommended way to implement functions that make use of legacy structs?

Also, is there any reason why p1v18 isn't part of the backward compatibility versions?

Thanks!

@nishanttotla
Copy link
Contributor Author

cc @calavera @dongluochen

@calavera
Copy link
Contributor

I think the only reasonable way we've found to do this is by checking the version in the http request. I'm super open to suggestions, but I don't think there is any easy way to handle those. See what we do for docker inspect:

https://github.com/docker/docker/blob/master/daemon/inspect.go#L19-L27

Re p1v18: there was nothing defined to keep backward compatibility around before p1v19 😭

@nishanttotla
Copy link
Contributor Author

Thanks @calavera.

For reference, here's how Engine does it by defining a separate function: https://github.com/docker/docker/blob/2658341b5fe9dec5c4839f0721219111fb08b43f/daemon/inspect_unix.go#L24

And then using a wrapper function: https://github.com/docker/docker/blob/2658341b5fe9dec5c4839f0721219111fb08b43f/daemon/inspect.go#L19

(Thanks to @tiborvass for pointing that out).

Also, a related issue is this, requiring to always specify API version: moby/moby#21157

(cc @thaJeztah)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants