Little helper to run CNCF's k3s in Docker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
k3d/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go

29 lines
806 B

5 years ago
package wclayer
import (
"context"
5 years ago
"github.com/Microsoft/hcsshim/internal/hcserror"
"github.com/Microsoft/hcsshim/internal/oc"
"go.opencensus.io/trace"
5 years ago
)
// LayerExists will return true if a layer with the given id exists and is known
// to the system.
func LayerExists(ctx context.Context, path string) (_ bool, err error) {
5 years ago
title := "hcsshim::LayerExists"
ctx, span := trace.StartSpan(ctx, title)
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
span.AddAttributes(trace.StringAttribute("path", path))
5 years ago
// Call the procedure itself.
var exists uint32
err = layerExists(&stdDriverInfo, path, &exists)
if err != nil {
return false, hcserror.New(err, title+" - failed", "")
}
span.AddAttributes(trace.BoolAttribute("layer-exists", exists != 0))
5 years ago
return exists != 0, nil
}