Documentation
¶
Index ¶
- func TaskOutputModes() string
- type LogReplayer
- type NoOpOutputWatcher
- type Opts
- type OutputWatcher
- type RunCache
- type TaskCache
- func (tc TaskCache) OnError(terminal *cli.PrefixedUi, logger hclog.Logger)
- func (tc TaskCache) OutputWriter(prefix string, ioWriter io.Writer) (io.WriteCloser, error)
- func (tc TaskCache) ReplayLogFile(prefixedUI *cli.PrefixedUi, progressLogger hclog.Logger)
- func (tc *TaskCache) RestoreOutputs(ctx context.Context, prefixedUI *cli.PrefixedUi, progressLogger hclog.Logger) (cache.ItemStatus, error)
- func (tc *TaskCache) SaveOutputs(ctx context.Context, logger hclog.Logger, terminal cli.Ui, duration int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TaskOutputModes ¶
func TaskOutputModes() string
TaskOutputModes creates the description string for task outputs
Types ¶
type LogReplayer ¶
type LogReplayer = func(logger hclog.Logger, output *cli.PrefixedUi, logFile turbopath.AbsoluteSystemPath)
LogReplayer is a function that is responsible for replaying the contents of a given log file
type NoOpOutputWatcher ¶
type NoOpOutputWatcher struct{}
NoOpOutputWatcher implements OutputWatcher, but always considers every glob to have changed
func (NoOpOutputWatcher) GetChangedOutputs ¶
func (NoOpOutputWatcher) GetChangedOutputs(_ context.Context, _ string, repoRelativeOutputGlobs []string) ([]string, int, error)
GetChangedOutputs implements OutputWatcher.GetChangedOutputs. Since this is a no-op watcher, no tracking is done.
func (NoOpOutputWatcher) NotifyOutputsWritten ¶
func (NoOpOutputWatcher) NotifyOutputsWritten(_ context.Context, _ string, _ hash.TaskOutputs, _ int) error
NotifyOutputsWritten implements OutputWatcher.NotifyOutputsWritten. Since this is a no-op watcher, consider all globs to have changed
type Opts ¶
type Opts struct { SkipReads bool SkipWrites bool TaskOutputModeOverride *util.TaskOutputMode LogReplayer LogReplayer OutputWatcher OutputWatcher }
Opts holds the configurable options for a RunCache instance
func (*Opts) SetTaskOutputMode ¶
SetTaskOutputMode parses the task output mode from string and then sets it in opts
type OutputWatcher ¶
type OutputWatcher interface { // GetChangedOutputs returns which of the given globs have changed since the specified hash was last run GetChangedOutputs(ctx context.Context, hash string, repoRelativeOutputGlobs []string) ([]string, int, error) // NotifyOutputsWritten tells the watcher that the given globs have been cached with the specified hash NotifyOutputsWritten(ctx context.Context, hash string, repoRelativeOutputGlobs hash.TaskOutputs, timeSaved int) error }
OutputWatcher instances are responsible for tracking changes to task outputs
type RunCache ¶
type RunCache struct {
// contains filtered or unexported fields
}
RunCache represents the interface to the cache for a single `turbo run`
func New ¶
func New(cache cache.Cache, repoRoot turbopath.AbsoluteSystemPath, opts Opts, colorCache *colorcache.ColorCache) *RunCache
New returns a new instance of RunCache, wrapping the given cache
type TaskCache ¶
type TaskCache struct { ExpandedOutputs []turbopath.AnchoredSystemPath LogFileName turbopath.AbsoluteSystemPath // contains filtered or unexported fields }
TaskCache represents a single task's (package-task?) interface to the RunCache and controls access to the task's outputs
func (TaskCache) OnError ¶
func (tc TaskCache) OnError(terminal *cli.PrefixedUi, logger hclog.Logger)
OnError replays the logfile if --output-mode=errors-only. This is called if the task exited with an non-zero error code.
func (TaskCache) OutputWriter ¶
OutputWriter creates a sink suitable for handling the output of the command associated with this task.
func (TaskCache) ReplayLogFile ¶
func (tc TaskCache) ReplayLogFile(prefixedUI *cli.PrefixedUi, progressLogger hclog.Logger)
ReplayLogFile writes out the stored logfile to the terminal
func (*TaskCache) RestoreOutputs ¶
func (tc *TaskCache) RestoreOutputs(ctx context.Context, prefixedUI *cli.PrefixedUi, progressLogger hclog.Logger) (cache.ItemStatus, error)
RestoreOutputs attempts to restore output for the corresponding task from the cache. Returns the cacheStatus, the timeSaved, and error values, so the consumer can understand what happened in here.