...

Source file src/github.com/Microsoft/hcsshim/internal/wclayer/layerid.go

Documentation: github.com/Microsoft/hcsshim/internal/wclayer

     1  //go:build windows
     2  
     3  package wclayer
     4  
     5  import (
     6  	"context"
     7  	"path/filepath"
     8  
     9  	"github.com/Microsoft/go-winio/pkg/guid"
    10  	"github.com/Microsoft/hcsshim/internal/oc"
    11  	"go.opencensus.io/trace"
    12  )
    13  
    14  // LayerID returns the layer ID of a layer on disk.
    15  func LayerID(ctx context.Context, path string) (_ guid.GUID, err error) {
    16  	title := "hcsshim::LayerID"
    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  	_, file := filepath.Split(path)
    23  	return NameToGuid(ctx, file)
    24  }
    25  

View as plain text