kubernetes/vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerid.go
Davanum Srinivas 9f00e5769e
Update hcsshim to v0.8.9
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-19 19:53:55 -04:00

23 lines
556 B
Go

package wclayer
import (
"context"
"path/filepath"
"github.com/Microsoft/go-winio/pkg/guid"
"github.com/Microsoft/hcsshim/internal/oc"
"go.opencensus.io/trace"
)
// LayerID returns the layer ID of a layer on disk.
func LayerID(ctx context.Context, path string) (_ guid.GUID, err error) {
title := "hcsshim::LayerID"
ctx, span := trace.StartSpan(ctx, title)
defer span.End()
defer func() { oc.SetSpanStatus(span, err) }()
span.AddAttributes(trace.StringAttribute("path", path))
_, file := filepath.Split(path)
return NameToGuid(ctx, file)
}