1package wclayer
2
3import (
4	"context"
5
6	"github.com/Microsoft/hcsshim/internal/hcserror"
7	"github.com/Microsoft/hcsshim/internal/oc"
8	"go.opencensus.io/trace"
9)
10
11// DestroyLayer will remove the on-disk files representing the layer with the given
12// path, including that layer's containing folder, if any.
13func DestroyLayer(ctx context.Context, path string) (err error) {
14	title := "hcsshim::DestroyLayer"
15	ctx, span := trace.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
16	defer span.End()
17	defer func() { oc.SetSpanStatus(span, err) }()
18	span.AddAttributes(trace.StringAttribute("path", path))
19
20	err = destroyLayer(&stdDriverInfo, path)
21	if err != nil {
22		return hcserror.New(err, title+" - failed", "")
23	}
24	return nil
25}
26