...
1
2
3 package wclayer
4
5 import (
6 "context"
7
8 "github.com/Microsoft/hcsshim/internal/hcserror"
9 "github.com/Microsoft/hcsshim/internal/oc"
10 "go.opencensus.io/trace"
11 )
12
13
14
15 func LayerExists(ctx context.Context, path string) (_ bool, err error) {
16 title := "hcsshim::LayerExists"
17 ctx, span := oc.StartSpan(ctx, title)
18 defer span.End()
19 defer func() { oc.SetSpanStatus(span, err) }()
20 span.AddAttributes(trace.StringAttribute("path", path))
21
22
23 var exists uint32
24 err = layerExists(&stdDriverInfo, path, &exists)
25 if err != nil {
26 return false, hcserror.New(err, title, "")
27 }
28 span.AddAttributes(trace.BoolAttribute("layer-exists", exists != 0))
29 return exists != 0, nil
30 }
31
View as plain text