Skip to content

api/types: migrate more types to separate packages#48057

Merged
vvoland merged 9 commits intomoby:masterfrom
thaJeztah:migrate_more_types
Jul 2, 2024
Merged

api/types: migrate more types to separate packages#48057
vvoland merged 9 commits intomoby:masterfrom
thaJeztah:migrate_more_types

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jun 25, 2024

api/types: move container-networksettings types to api/types/container

This moves the NetworkSettings, NetworkSettingsBase, DefaultNetworkSettings,
and SummaryNetworkSettings types to the api/types/container package, and
deprecates the old location.

api/types: move container Health types to api/types/container

This moves the Health and HealthcheckResult types to the container package,
as well as the related NoHealthcheck, Starting, Healthy, and Unhealthy
consts.

api/types: move MountPoint to api/types/container

This moves the MountPoint type to the container package, and
deprecates the old location.

api/types: move Port to api/types/container

This moves the Port type to the container package, and
deprecates the old location.

api/types: move GraphDriverData to api/types/storage

The GraphDriverData type is shared between images and containers, and
putting it in either package would result in a circular import, so adding
a new package for this type.

api/types: move ImageInspect and RootFS to api/types/image

This moves the ImageInspect and RootFS types to the image package,
and deprecates the old location.

api/types: move ContainerState to api/types/image

This moves the ContainerState type to the container package,
renames it to State, and deprecates the old location.

api/types: move Container to api/types/container

This moves the Container type to the image package, rename it to
Summary, and deprecates the old location.

api/types: move container-inspect types to api/types/container

This moves the ContainerJSONBase, ContainerJSON and ContainerNode
types to the api/types/container package and deprecates the old location.

  • ContainerJSONBase was renamed to Base
  • ContainerJSON was rnamed to InspectResponse

- What I did

- How I did it

- How to verify it

- Description for the changelog

- move `api/types.NetworkSettings` to `api/types/container.NetworkSettings`
- move `api/types.NetworkSettingsBase` to `api/types/container.NetworkSettingsBase`
- move `api/types.DefaultNetworkSettings` to `api/types/container.DefaultNetworkSettings`
- move `api/types.SummaryNetworkSettings` to `api/types/container.NetworkSettingsSummary`
- move `api/types.Health` to `api/types/container.Health`
- move `api/types.HealthcheckResult` to `api/types/container.HealthcheckResult`
  move the `NoHealthcheck`, `Starting`, `Healthy`, and `Unhealthy` consts
  from api/types to api/types/container
- move `api/types.MountPoint` to `api/types/container.MountPoint`
- move `api/types.Port` to `api/types/container.Port`
- move `api/types.GraphDriverData` type to`api/types/storage.DriverData`
- move `api/types.ImageInspect` to `api/types/image.InspectResponse`
- move `api/types.RootFS` to `api/types/image.RootFS`
- move `api/types.ContainerState` to `api/types/container.State`
- move `api/types.Container` to `api/types/container.Summary`
- move `api/types.ContainerJSONBase` to `api/types/container.InspectBase`
- move `api/types.ContainerJSON` to `api/types/container.InspectResponse`
- move `api/types.ContainerNode` to `api/types/container`. This type is deprecated
  and will be removed in the next release.

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

@thaJeztah thaJeztah changed the title Migrate more types api/types: migrate more types to separate packages Jun 25, 2024
@thaJeztah thaJeztah force-pushed the migrate_more_types branch 3 times, most recently from d46c4f3 to a4f4283 Compare June 26, 2024 21:05
@thaJeztah thaJeztah modified the milestone: 28.0.0 Jun 26, 2024
@thaJeztah thaJeztah marked this pull request as ready for review June 26, 2024 21:06
@thaJeztah thaJeztah requested a review from tianon as a code owner June 26, 2024 21:06
@thaJeztah thaJeztah self-assigned this Jun 27, 2024
@thaJeztah thaJeztah added the kind/refactor PR's that refactor, or clean-up code label Jul 1, 2024

// DefaultNetworkSettings holds network information
// during the 2 release deprecation period.
// It will be removed in Docker 1.11.
Copy link
Contributor

Choose a reason for hiding this comment

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

🙈
Should we remove that comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

LOL, I kept it as a reminding "why the h*ck didn't we still do that?". I know Albin was working on some of that, so I kept it for now.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we need to discuss what we do with #45945. Ideally, we should not include this struct in newer API versions as it polutes the output of docker inspect.

// ContainerJSONBase contained all fields for API < 1.19, and InspectResponse
// held fields that were added in API 1.19 and up. Given that the minimum
// supported API version is now 1.24, we no longer use the separate type.
type Base struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: InspectBase would be slightly better IMO. Mainly because it's coupled with InspectResponse and we'd like to combine them anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion!

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated 👍

// for API version 1.18 and older.
//
// TODO(thaJeztah): combine Base and InspectResponse into a single struct.
// The split between Base (ContainerJSONBase) and InspecResponse (InspectResponse)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// The split between Base (ContainerJSONBase) and InspecResponse (InspectResponse)
// The split between Base (ContainerJSONBase) and InspectResponse (InspectResponse)

nit: typo

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed 👍

Copy link
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! (+1 on @vvoland's nits)

thaJeztah added 6 commits July 2, 2024 12:46
This moves the NetworkSettings, NetworkSettingsBase, DefaultNetworkSettings,
and SummaryNetworkSettings types to the api/types/container package, and
deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This moves the `Health` and `HealthcheckResult` types to the container package,
as well as the related `NoHealthcheck`, `Starting`, `Healthy`, and `Unhealthy`
consts.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This moves the `MountPoint` type to the container package, and
deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This moves the `Port` type to the container package, and
deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
The `GraphDriverData` type is shared between images and containers, and
putting it in either package would result in a circular import, so adding
a new package for this type.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This moves the `ImageInspect` and `RootFS` types to the image package,
and deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added 3 commits July 2, 2024 12:46
This moves the `ContainerState` type to the container package,
renames it to `State`, and deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This moves the `Container` type to the containere package, rename
it to `Summary`, and deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This moves the `ContainerJSONBase`, `ContainerJSON` and `ContainerNode`
types to the api/types/container package and deprecates the old location.

- `ContainerJSONBase` was renamed to `InspectBase`
- `ContainerJSON` was rnamed to `InspectResponse`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the migrate_more_types branch from a4f4283 to 1abc8f6 Compare July 2, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants