replay

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package replay provides a biome that records all events to an underlying biome and then allows replaying those command invocations later.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

A Recorder wraps another biome and records its commands in memory. The interactions are saved to the filesystem when it is finished.

func NewRecorder

func NewRecorder(dir string, bio biome.Biome) *Recorder

NewRecorder returns a new Recorder biome that wraps the given biome and saves to dir on Close.

func (*Recorder) Close

func (rec *Recorder) Close() error

Close writes the recorded invocations to the directory passed into NewRecorder.

func (*Recorder) Describe

func (rec *Recorder) Describe() *biome.Descriptor

func (*Recorder) Dirs

func (rec *Recorder) Dirs() *biome.Dirs

func (*Recorder) IsAbsPath

func (rec *Recorder) IsAbsPath(path string) bool

func (*Recorder) JoinPath

func (rec *Recorder) JoinPath(elem ...string) string

func (*Recorder) Run

func (rec *Recorder) Run(ctx context.Context, invoke *biome.Invocation) error

type Replay

type Replay struct {
	// contains filtered or unexported fields
}

Replay is a biome that replays Run commands from a recorded file.

func Load

func Load(dir string, desc *biome.Descriptor) (*Replay, error)

Load reads the biome interactions in the given directory for the given descriptor and returns a biome that repeats those commands.

func (*Replay) Describe

func (r *Replay) Describe() *biome.Descriptor

Describe returns the recorded descriptor.

func (*Replay) Dirs

func (r *Replay) Dirs() *biome.Dirs

Dirs returns the directories used in the recording.

func (*Replay) IsAbsPath

func (r *Replay) IsAbsPath(path string) bool

func (*Replay) JoinPath

func (r *Replay) JoinPath(elem ...string) string

func (*Replay) Run

func (r *Replay) Run(ctx context.Context, invoke *biome.Invocation) error

Run attempts to use the next invocation in the replay sequence, returning an error if the invocation parameters don't match. Once Run encounters a mismatched invocation, subsequent calls to Run will fail.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL