layer_windows.go 654 B

12345678910111213141516171819202122232425262728293031323334
  1. package layer
  2. import "errors"
  3. // GetLayerPath returns the path to a layer
  4. func GetLayerPath(s Store, layer ChainID) (string, error) {
  5. ls, ok := s.(*layerStore)
  6. if !ok {
  7. return "", errors.New("unsupported layer store")
  8. }
  9. ls.layerL.Lock()
  10. defer ls.layerL.Unlock()
  11. rl, ok := ls.layerMap[layer]
  12. if !ok {
  13. return "", ErrLayerDoesNotExist
  14. }
  15. path, err := ls.driver.Get(rl.cacheID, "")
  16. if err != nil {
  17. return "", err
  18. }
  19. if err := ls.driver.Put(rl.cacheID); err != nil {
  20. return "", err
  21. }
  22. return path, nil
  23. }
  24. func (ls *layerStore) mountID(name string) string {
  25. // windows has issues if container ID doesn't match mount ID
  26. return name
  27. }