|
@@ -273,7 +273,7 @@ func (graph *Graph) Delete(name string) error {
|
|
|
// Map returns a list of all images in the graph, addressable by ID.
|
|
|
func (graph *Graph) Map() (map[string]*Image, error) {
|
|
|
images := make(map[string]*Image)
|
|
|
- err := graph.WalkAll(func(image *Image) {
|
|
|
+ err := graph.walkAll(func(image *Image) {
|
|
|
images[image.ID] = image
|
|
|
})
|
|
|
if err != nil {
|
|
@@ -282,9 +282,9 @@ func (graph *Graph) Map() (map[string]*Image, error) {
|
|
|
return images, nil
|
|
|
}
|
|
|
|
|
|
-// WalkAll iterates over each image in the graph, and passes it to a handler.
|
|
|
+// walkAll iterates over each image in the graph, and passes it to a handler.
|
|
|
// The walking order is undetermined.
|
|
|
-func (graph *Graph) WalkAll(handler func(*Image)) error {
|
|
|
+func (graph *Graph) walkAll(handler func(*Image)) error {
|
|
|
files, err := ioutil.ReadDir(graph.Root)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -306,7 +306,7 @@ func (graph *Graph) WalkAll(handler func(*Image)) error {
|
|
|
// If an image has no children, it will not have an entry in the table.
|
|
|
func (graph *Graph) ByParent() (map[string][]*Image, error) {
|
|
|
byParent := make(map[string][]*Image)
|
|
|
- err := graph.WalkAll(func(image *Image) {
|
|
|
+ err := graph.walkAll(func(image *Image) {
|
|
|
parent, err := graph.Get(image.Parent)
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -328,7 +328,7 @@ func (graph *Graph) Heads() (map[string]*Image, error) {
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- err = graph.WalkAll(func(image *Image) {
|
|
|
+ err = graph.walkAll(func(image *Image) {
|
|
|
// If it's not in the byParent lookup table, then
|
|
|
// it's not a parent -> so it's a head!
|
|
|
if _, exists := byParent[image.ID]; !exists {
|