...
|
...
|
@@ -273,7 +273,7 @@ func (graph *Graph) Delete(name string) error {
|
273
|
273
|
// Map returns a list of all images in the graph, addressable by ID.
|
274
|
274
|
func (graph *Graph) Map() (map[string]*Image, error) {
|
275
|
275
|
images := make(map[string]*Image)
|
276
|
|
- err := graph.WalkAll(func(image *Image) {
|
|
276
|
+ err := graph.walkAll(func(image *Image) {
|
277
|
277
|
images[image.ID] = image
|
278
|
278
|
})
|
279
|
279
|
if err != nil {
|
...
|
...
|
@@ -282,9 +282,9 @@ func (graph *Graph) Map() (map[string]*Image, error) {
|
282
|
282
|
return images, nil
|
283
|
283
|
}
|
284
|
284
|
|
285
|
|
-// WalkAll iterates over each image in the graph, and passes it to a handler.
|
|
285
|
+// walkAll iterates over each image in the graph, and passes it to a handler.
|
286
|
286
|
// The walking order is undetermined.
|
287
|
|
-func (graph *Graph) WalkAll(handler func(*Image)) error {
|
|
287
|
+func (graph *Graph) walkAll(handler func(*Image)) error {
|
288
|
288
|
files, err := ioutil.ReadDir(graph.Root)
|
289
|
289
|
if err != nil {
|
290
|
290
|
return err
|
...
|
...
|
@@ -306,7 +306,7 @@ func (graph *Graph) WalkAll(handler func(*Image)) error {
|
306
|
306
|
// If an image has no children, it will not have an entry in the table.
|
307
|
307
|
func (graph *Graph) ByParent() (map[string][]*Image, error) {
|
308
|
308
|
byParent := make(map[string][]*Image)
|
309
|
|
- err := graph.WalkAll(func(image *Image) {
|
|
309
|
+ err := graph.walkAll(func(image *Image) {
|
310
|
310
|
parent, err := graph.Get(image.Parent)
|
311
|
311
|
if err != nil {
|
312
|
312
|
return
|
...
|
...
|
@@ -328,7 +328,7 @@ func (graph *Graph) Heads() (map[string]*Image, error) {
|
328
|
328
|
if err != nil {
|
329
|
329
|
return nil, err
|
330
|
330
|
}
|
331
|
|
- err = graph.WalkAll(func(image *Image) {
|
|
331
|
+ err = graph.walkAll(func(image *Image) {
|
332
|
332
|
// If it's not in the byParent lookup table, then
|
333
|
333
|
// it's not a parent -> so it's a head!
|
334
|
334
|
if _, exists := byParent[image.ID]; !exists {
|