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.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-06-25 22:10:06 +02:00
parent e12b7493b9
commit da039ca918
6 changed files with 23 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ import (
"github.com/docker/docker/api/types/filters"
imagetypes "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/storage"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/builder/remotecontext"
"github.com/docker/docker/dockerversion"
@@ -376,7 +377,7 @@ func (ir *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, er
Os: img.OperatingSystem(),
OsVersion: img.OSVersion,
Size: img.Details.Size,
GraphDriver: types.GraphDriverData{
GraphDriver: storage.DriverData{
Name: img.Details.Driver,
Data: img.Details.Metadata,
},

View File

@@ -1917,7 +1917,7 @@ definitions:
type: "string"
example: "4443"
GraphDriverData:
DriverData:
description: |
Information about the storage driver used to store the container's and
image's filesystem.
@@ -2107,7 +2107,7 @@ definitions:
format: "int64"
example: 1239828
GraphDriver:
$ref: "#/definitions/GraphDriverData"
$ref: "#/definitions/DriverData"
RootFS:
description: |
Information about the image's RootFS, including the layer IDs.
@@ -7123,7 +7123,7 @@ paths:
HostConfig:
$ref: "#/definitions/HostConfig"
GraphDriver:
$ref: "#/definitions/GraphDriverData"
$ref: "#/definitions/DriverData"
SizeRw:
description: |
The size of files that have been created or changed by this

View File

@@ -1,13 +1,13 @@
package types
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// GraphDriverData Information about the storage driver used to store the container's and
// DriverData Information about the storage driver used to store the container's and
// image's filesystem.
//
// swagger:model GraphDriverData
type GraphDriverData struct {
// swagger:model DriverData
type DriverData struct {
// Low-level storage metadata, provided as key/value pairs.
//

View File

@@ -6,6 +6,7 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/storage"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/volume"
)
@@ -122,7 +123,7 @@ type ImageInspect struct {
// GraphDriver holds information about the storage driver used to store the
// container's and image's filesystem.
GraphDriver GraphDriverData
GraphDriver storage.DriverData
// RootFS contains information about the image's RootFS, including the
// layer IDs.
@@ -242,7 +243,7 @@ type ContainerJSONBase struct {
AppArmorProfile string
ExecIDs []string
HostConfig *container.HostConfig
GraphDriver GraphDriverData
GraphDriver storage.DriverData
SizeRw *int64 `json:",omitempty"`
SizeRootFs *int64 `json:",omitempty"`
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/storage"
"github.com/docker/docker/api/types/volume"
)
@@ -260,3 +261,9 @@ type MountPoint = container.MountPoint
//
// Deprecated: use [container.Port].
type Port = container.Port
// GraphDriverData Information about the storage driver used to store the container's and
// image's filesystem.
//
// Deprecated: use [storage.DriverData].
type GraphDriverData = storage.DriverData

View File

@@ -4,7 +4,6 @@ set -eu
swagger generate model -f api/swagger.yaml \
-t api -m types --skip-validator -C api/swagger-gen.yaml \
-n ErrorResponse \
-n GraphDriverData \
-n IdResponse \
-n Plugin \
-n PluginDevice \
@@ -12,6 +11,10 @@ swagger generate model -f api/swagger.yaml \
-n PluginEnv \
-n PluginInterfaceType
swagger generate model -f api/swagger.yaml \
-t api -m types/storage --skip-validator -C api/swagger-gen.yaml \
-n DriverData
swagger generate model -f api/swagger.yaml \
-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
-n ContainerCreateResponse \