layer/layer_windows.go
4f0d95fa
 package layer // import "github.com/docker/docker/layer"
500e77ba
 
7a7357da
 import (
 	"errors"
 )
 
 // Getter is an interface to get the path to a layer on the host.
 type Getter interface {
 	// GetLayerPath gets the path for the layer. This is different from Get()
7c5cf583
 	// since that returns an interface to account for unmountable layers.
7a7357da
 	GetLayerPath(id string) (string, error)
 }
500e77ba
 
 // GetLayerPath returns the path to a layer
 func GetLayerPath(s Store, layer ChainID) (string, error) {
 	ls, ok := s.(*layerStore)
 	if !ok {
 		return "", errors.New("unsupported layer store")
 	}
 	ls.layerL.Lock()
 	defer ls.layerL.Unlock()
 
 	rl, ok := ls.layerMap[layer]
 	if !ok {
 		return "", ErrLayerDoesNotExist
 	}
 
afd305c4
 	if layerGetter, ok := ls.driver.(Getter); ok {
7a7357da
 		return layerGetter.GetLayerPath(rl.cacheID)
 	}
afd305c4
 	path, err := ls.driver.Get(rl.cacheID, "")
500e77ba
 	if err != nil {
 		return "", err
 	}
 
afd305c4
 	if err := ls.driver.Put(rl.cacheID); err != nil {
500e77ba
 		return "", err
 	}
 
7a7357da
 	return path.Path(), nil
500e77ba
 }
 
d04fa49a
 func (ls *layerStore) mountID(name string) string {
 	// windows has issues if container ID doesn't match mount ID
 	return name
 }