getsharedbaseimages.go 966 B

12345678910111213141516171819202122232425262728293031
  1. //go:build windows
  2. package wclayer
  3. import (
  4. "context"
  5. "github.com/Microsoft/hcsshim/internal/hcserror"
  6. "github.com/Microsoft/hcsshim/internal/interop"
  7. "github.com/Microsoft/hcsshim/internal/oc"
  8. "go.opencensus.io/trace"
  9. )
  10. // GetSharedBaseImages will enumerate the images stored in the common central
  11. // image store and return descriptive info about those images for the purpose
  12. // of registering them with the graphdriver, graph, and tagstore.
  13. func GetSharedBaseImages(ctx context.Context) (_ string, err error) {
  14. title := "hcsshim::GetSharedBaseImages"
  15. ctx, span := oc.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
  16. defer span.End()
  17. defer func() { oc.SetSpanStatus(span, err) }()
  18. var buffer *uint16
  19. err = getBaseImages(&buffer)
  20. if err != nil {
  21. return "", hcserror.New(err, title, "")
  22. }
  23. imageData := interop.ConvertAndFreeCoTaskMemString(buffer)
  24. span.AddAttributes(trace.StringAttribute("imageData", imageData))
  25. return imageData, nil
  26. }