code: func (w *Worker) GetRemote(ctx context.Context, ref cache.ImmutableRef, createIfNeeded bool) (*solver.Remote, error) {
  	var diffIDs []layer.DiffID
  	var err error
  	if !createIfNeeded {
  		diffIDs, err = w.Layers.GetDiffIDs(ctx, ref.ID())
  		if err != nil {
  			return nil, err
  		}
  	} else {
  		if err := ref.Finalize(ctx, true); err != nil {
  			return nil, err
  		}
  		diffIDs, err = w.Layers.EnsureLayer(ctx, ref.ID())
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	descriptors := make([]ocispec.Descriptor, len(diffIDs))
  	for i, dgst := range diffIDs {
  		descriptors[i] = ocispec.Descriptor{
  			MediaType: images.MediaTypeDockerSchema2Layer,
  			Digest:    digest.Digest(dgst),
  			Size:      -1,
  		}
  	}
  
  	return &solver.Remote{
  		Descriptors: descriptors,
  		Provider:    &emptyProvider{},
  	}, nil
  }
docs: // GetRemote returns a remote snapshot reference for a local one