...

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

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

     1  //go:build windows
     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  // ActivateLayer will find the layer with the given id and mount it's filesystem.
    14  // For a read/write layer, the mounted filesystem will appear as a volume on the
    15  // host, while a read-only layer is generally expected to be a no-op.
    16  // An activated layer must later be deactivated via DeactivateLayer.
    17  func ActivateLayer(ctx context.Context, path string) (err error) {
    18  	title := "hcsshim::ActivateLayer"
    19  	ctx, span := oc.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
    20  	defer span.End()
    21  	defer func() { oc.SetSpanStatus(span, err) }()
    22  	span.AddAttributes(trace.StringAttribute("path", path))
    23  
    24  	err = activateLayer(&stdDriverInfo, path)
    25  	if err != nil {
    26  		return hcserror.New(err, title, "")
    27  	}
    28  	return nil
    29  }
    30  

View as plain text