Commit fd715a9
committed
cmd, pkg/podman: Turn Image into an interface
In reaction to the conversation in PR containers#1707, I made suggested changes
to the implementation in terms of how Image information, received
from Podman, is represented and treated in the Toolbx code. I used
the same procedure as in the case of representing Containers:
- Commit e611969
- Commit ec7eb59
In short, the JSON from 'podman inspect --type image' and
'podman images' are different, so logically, there should be
different implementations of the JSON.Unmarshaler interface [1]
for them as well. The new Image interface provides access to the
values parsed from the JSONs and two different concrete types,
which are implemented separately to handle the differences in
the JSONs.
GetImages() now returns an Images iterator-like structure that
handles image flattening and sorting internally. InspectImage()
returns an Image interface instead of map[string]interface{},
and the IsToolboxImage() function was replaced with the IsToolbx()
method on the Image interface.
[1] https://pkg.go.dev/encoding/json#Unmarshaler
Signed-off-by: Dalibor Kricka <[email protected]>1 parent c66ddd1 commit fd715a9
File tree
6 files changed
+317
-159
lines changed- src
- cmd
- pkg/podman
6 files changed
+317
-159
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 37 | | |
45 | 38 | | |
46 | 39 | | |
| |||
154 | 147 | | |
155 | 148 | | |
156 | 149 | | |
157 | | - | |
| 150 | + | |
158 | 151 | | |
159 | 152 | | |
160 | 153 | | |
161 | 154 | | |
162 | 155 | | |
163 | | - | |
164 | 156 | | |
165 | 157 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
169 | 161 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | 162 | | |
187 | 163 | | |
188 | | - | |
189 | 164 | | |
190 | 165 | | |
191 | 166 | | |
| |||
195 | 170 | | |
196 | 171 | | |
197 | 172 | | |
198 | | - | |
| 173 | + | |
199 | 174 | | |
200 | 175 | | |
201 | 176 | | |
202 | 177 | | |
203 | | - | |
204 | | - | |
205 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
206 | 181 | | |
207 | 182 | | |
208 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
95 | 101 | | |
96 | 102 | | |
97 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
0 commit comments