本文整理匯總了Golang中github.com/Microsoft/hcsshim.LayerWriter.Close方法的典型用法代碼示例。如果您正苦於以下問題:Golang LayerWriter.Close方法的具體用法?Golang LayerWriter.Close怎麽用?Golang LayerWriter.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Microsoft/hcsshim.LayerWriter
的用法示例。
在下文中一共展示了LayerWriter.Close方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: importLayer
// importLayer adds a new layer to the tag and graph store based on the given data.
func (d *Driver) importLayer(id string, layerData archive.Reader, parentLayerPaths []string) (size int64, err error) {
var w hcsshim.LayerWriter
w, err = hcsshim.NewLayerWriter(d.info, id, parentLayerPaths)
if err != nil {
return
}
size, err = writeLayerFromTar(layerData, w)
if err != nil {
w.Close()
return
}
err = w.Close()
if err != nil {
return
}
return
}
示例2: importLayer
// importLayer adds a new layer to the tag and graph store based on the given data.
func (d *Driver) importLayer(id string, layerData archive.Reader, parentLayerPaths []string) (size int64, err error) {
if hcsshim.IsTP4() {
// Import from TP4 format to maintain compatibility with existing images.
var tempFolder string
tempFolder, err = ioutil.TempDir("", "hcs")
if err != nil {
return
}
defer os.RemoveAll(tempFolder)
if size, err = chrootarchive.ApplyLayer(tempFolder, layerData); err != nil {
return
}
if err = hcsshim.ImportLayer(d.info, id, tempFolder, parentLayerPaths); err != nil {
return
}
return
}
var w hcsshim.LayerWriter
w, err = hcsshim.NewLayerWriter(d.info, id, parentLayerPaths)
if err != nil {
return
}
size, err = writeLayerFromTar(layerData, w)
if err != nil {
w.Close()
return
}
err = w.Close()
if err != nil {
return
}
return
}