Skip to content

Commit da039ca

Browse files
committed
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 <[email protected]>
1 parent e12b749 commit da039ca

6 files changed

Lines changed: 23 additions & 11 deletions

File tree

api/server/router/image/image_routes.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/docker/docker/api/types/filters"
2020
imagetypes "github.com/docker/docker/api/types/image"
2121
"github.com/docker/docker/api/types/registry"
22+
"github.com/docker/docker/api/types/storage"
2223
"github.com/docker/docker/api/types/versions"
2324
"github.com/docker/docker/builder/remotecontext"
2425
"github.com/docker/docker/dockerversion"
@@ -376,7 +377,7 @@ func (ir *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, er
376377
Os: img.OperatingSystem(),
377378
OsVersion: img.OSVersion,
378379
Size: img.Details.Size,
379-
GraphDriver: types.GraphDriverData{
380+
GraphDriver: storage.DriverData{
380381
Name: img.Details.Driver,
381382
Data: img.Details.Metadata,
382383
},

api/swagger.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ definitions:
19171917
type: "string"
19181918
example: "4443"
19191919

1920-
GraphDriverData:
1920+
DriverData:
19211921
description: |
19221922
Information about the storage driver used to store the container's and
19231923
image's filesystem.
@@ -2107,7 +2107,7 @@ definitions:
21072107
format: "int64"
21082108
example: 1239828
21092109
GraphDriver:
2110-
$ref: "#/definitions/GraphDriverData"
2110+
$ref: "#/definitions/DriverData"
21112111
RootFS:
21122112
description: |
21132113
Information about the image's RootFS, including the layer IDs.
@@ -7123,7 +7123,7 @@ paths:
71237123
HostConfig:
71247124
$ref: "#/definitions/HostConfig"
71257125
GraphDriver:
7126-
$ref: "#/definitions/GraphDriverData"
7126+
$ref: "#/definitions/DriverData"
71277127
SizeRw:
71287128
description: |
71297129
The size of files that have been created or changed by this
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package types
1+
package storage
22

33
// This file was generated by the swagger tool.
44
// Editing this file might prove futile when you re-run the swagger generate command
55

6-
// GraphDriverData Information about the storage driver used to store the container's and
6+
// DriverData Information about the storage driver used to store the container's and
77
// image's filesystem.
88
//
9-
// swagger:model GraphDriverData
10-
type GraphDriverData struct {
9+
// swagger:model DriverData
10+
type DriverData struct {
1111

1212
// Low-level storage metadata, provided as key/value pairs.
1313
//

api/types/types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/docker/docker/api/types/container"
77
"github.com/docker/docker/api/types/filters"
88
"github.com/docker/docker/api/types/image"
9+
"github.com/docker/docker/api/types/storage"
910
"github.com/docker/docker/api/types/swarm"
1011
"github.com/docker/docker/api/types/volume"
1112
)
@@ -122,7 +123,7 @@ type ImageInspect struct {
122123

123124
// GraphDriver holds information about the storage driver used to store the
124125
// container's and image's filesystem.
125-
GraphDriver GraphDriverData
126+
GraphDriver storage.DriverData
126127

127128
// RootFS contains information about the image's RootFS, including the
128129
// layer IDs.
@@ -242,7 +243,7 @@ type ContainerJSONBase struct {
242243
AppArmorProfile string
243244
ExecIDs []string
244245
HostConfig *container.HostConfig
245-
GraphDriver GraphDriverData
246+
GraphDriver storage.DriverData
246247
SizeRw *int64 `json:",omitempty"`
247248
SizeRootFs *int64 `json:",omitempty"`
248249
}

api/types/types_deprecated.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/docker/docker/api/types/image"
77
"github.com/docker/docker/api/types/network"
88
"github.com/docker/docker/api/types/registry"
9+
"github.com/docker/docker/api/types/storage"
910
"github.com/docker/docker/api/types/volume"
1011
)
1112

@@ -260,3 +261,9 @@ type MountPoint = container.MountPoint
260261
//
261262
// Deprecated: use [container.Port].
262263
type Port = container.Port
264+
265+
// GraphDriverData Information about the storage driver used to store the container's and
266+
// image's filesystem.
267+
//
268+
// Deprecated: use [storage.DriverData].
269+
type GraphDriverData = storage.DriverData

hack/generate-swagger-api.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ set -eu
44
swagger generate model -f api/swagger.yaml \
55
-t api -m types --skip-validator -C api/swagger-gen.yaml \
66
-n ErrorResponse \
7-
-n GraphDriverData \
87
-n IdResponse \
98
-n Plugin \
109
-n PluginDevice \
1110
-n PluginMount \
1211
-n PluginEnv \
1312
-n PluginInterfaceType
1413

14+
swagger generate model -f api/swagger.yaml \
15+
-t api -m types/storage --skip-validator -C api/swagger-gen.yaml \
16+
-n DriverData
17+
1518
swagger generate model -f api/swagger.yaml \
1619
-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
1720
-n ContainerCreateResponse \

0 commit comments

Comments
 (0)