Skip to content

api/server/router/container: move API adjustments to API#48672

Merged
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:inspect_move_to_api
Oct 16, 2024
Merged

api/server/router/container: move API adjustments to API#48672
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:inspect_move_to_api

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

api/server/router/container: fix inconsistent receiver name

It's good practice to use a consistent name; we couldn't use r as name,
as it's used for the request argument, and s honestly didn't make much
sense as name, so changing it to c.

api/server/router/container: move API adjustments to API

The daemon used to have various implementation to adjust the container-inspect
output for different API versions, which could return different go structs,
and because of that required a function with a interface{} output type.

Most of those adjustments have been removed, and we no longer need separate
types for backward compatibility with old API versions.

This patch;

  • Removes the Daemon.ContainerInspectCurrent method
  • Introduces a backend.ContainerInspectOptions struct
  • Updates the Daemon.ContainerInspect method's signature to accept the above
  • Moves API-version specific adjustments to api/server/router/container,
    similar to how such adjustments are made for other endpoints.

Note that we should probably change the backend's signature further,
and define separate types for the backend's inspect and the API's
inspect response. Considering that the Backend signatures should be
considered "internal", we can do that in a future change.

- Description for the changelog

- daemon: remove `Daemon.ContainerInspectCurrent()` method
- daemon: change `Daemon.ContainerInspect()` signature to accept a `backend.ContainerInspectOptions` struct

- A picture of a cute animal (not mandatory but encouraged)

It's good practice to use a consistent name; we couldn't use `r` as name,
as it's used for the request argument, and `s` honestly didn't make much
sense as name, so changing it to `c`.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
The daemon used to have various implementation to adjust the container-inspect
output for different API versions, which could return different go structs,
and because of that required a function with a `interface{}` output type.

Most of those adjustments have been removed, and we no longer need separate
types for backward compatibility with old API versions.

This patch;

- Removes the Daemon.ContainerInspectCurrent method
- Introduces a backend.ContainerInspectOptions struct
- Updates the Daemon.ContainerInspect method's signature to accept the above
- Moves API-version specific adjustments to api/server/router/container,
  similar to how such adjustments are made for other endpoints.

Note that we should probably change the backend's signature further,
and define separate types for the backend's inspect and the API's
inspect response. Considering that the Backend signatures should be
considered "internal", we can do that in a future change.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah added area/api API area/daemon Core Engine kind/refactor PR's that refactor, or clean-up code area/go-sdk impact/go-sdk Noteworthy (compatibility changes) in the Go SDK labels Oct 15, 2024
@thaJeztah thaJeztah added this to the 28.0.0 milestone Oct 15, 2024
@thaJeztah thaJeztah self-assigned this Oct 15, 2024
Copy link
Copy Markdown
Contributor

@vvoland vvoland left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@laurazard laurazard left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit 3f2bf91 into moby:master Oct 16, 2024
@thaJeztah thaJeztah deleted the inspect_move_to_api branch October 16, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API area/daemon Core Engine area/go-sdk impact/go-sdk Noteworthy (compatibility changes) in the Go SDK kind/refactor PR's that refactor, or clean-up code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants