func (c *Coordinator) CheckCache(ctx context.Context, tasks []*Task) (uncached []*Task, specs []*batcheslib.ChangesetSpec, err error) {
	for _, t := range tasks {
		cachedSpecs, found, err := c.checkCacheForTask(ctx, t)
		if err != nil {
			return nil, nil, err
		}
		if !found {
			uncached = append(uncached, t)
			continue
		}
		specs = append(specs, cachedSpecs...)
	}
	return uncached, specs, nil
}
CheckCache checks whether the internal ExecutionCache contains
ChangesetSpecs for the given Tasks. If cached ChangesetSpecs exist, those
are returned, otherwise the Task, to be executed later.
package executor
import (
	"context"
	"time"
	"github.com/cockroachdb/errors"
	"github.com/hashicorp/go-multierror"
	batcheslib "github.com/sourcegraph/sourcegraph/lib/batches"
	"github.com/sourcegraph/src-cli/internal/api"
	"github.com/sourcegraph/src-cli/internal/batches"
	"github.com/sourcegraph/src-cli/internal/batches/docker"
	"github.com/sourcegraph/src-cli/internal/batches/graphql"
	"github.com/sourcegraph/src-cli/internal/batches/log"
	"github.com/sourcegraph/src-cli/internal/batches/repozip"
	"github.com/sourcegraph/src-cli/internal/batches/workspace"
)
type taskExecutor interface {
	Start(context.Context, []*Task, TaskExecutionUI)
	Wait(context.Context) ([]taskResult, error)
}
type Coordinator struct {
	opts NewCoordinatorOpts
	cache      ExecutionCache
	exec       taskExecutor
	logManager log.LogManager
}
type repoNameResolver func(ctx context.Context, name string) (*graphql.Repository, error)
type imageEnsurer func(ctx context.Context, name string) (docker.Image, error)
type NewCoordinatorOpts struct {
	ResolveRepoName repoNameResolver
	EnsureImage     imageEnsurer
	Creator         workspace.Creator
	Client          api.Client
	CacheDir   string
	ClearCache bool
	SkipErrors bool
	Features batches.FeatureFlags
	ImportChangesets bool
	CleanArchives bool
	Parallelism   int
	Timeout       time.Duration
	KeepLogs      bool
	TempDir       string
}
func NewCoordinator(opts NewCoordinatorOpts) *Coordinator {
	cache := NewCache(opts.CacheDir)
	logManager := log.NewManager(opts.TempDir, opts.KeepLogs)
	exec := newExecutor(newExecutorOpts{
		RepoArchiveRegistry: repozip.NewArchiveRegistry(opts.Client, opts.CacheDir, opts.CleanArchives),
		EnsureImage:         opts.EnsureImage,
		Creator:             opts.Creator,
		Logger:              logManager,
		Parallelism: opts.Parallelism,
		Timeout:     opts.Timeout,
		TempDir:     opts.TempDir,
	})
	return &Coordinator{
		opts: opts,
		cache:      cache,
		exec:       exec,
		logManager: logManager,
	}
}