1package hcsshim 2 3import "github.com/sirupsen/logrus" 4 5// LayerExists will return true if a layer with the given id exists and is known 6// to the system. 7func LayerExists(info DriverInfo, id string) (bool, error) { 8 title := "hcsshim::LayerExists " 9 logrus.Debugf(title+"Flavour %d ID %s", info.Flavour, id) 10 11 // Convert info to API calling convention 12 infop, err := convertDriverInfo(info) 13 if err != nil { 14 logrus.Error(err) 15 return false, err 16 } 17 18 // Call the procedure itself. 19 var exists uint32 20 21 err = layerExists(&infop, id, &exists) 22 if err != nil { 23 err = makeErrorf(err, title, "id=%s flavour=%d", id, info.Flavour) 24 logrus.Error(err) 25 return false, err 26 } 27 28 logrus.Debugf(title+"succeeded flavour=%d id=%s exists=%d", info.Flavour, id, exists) 29 return exists != 0, nil 30} 31