scenario

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scenario reads scenario files. A scenario is a file of timed actions that plugyard carries out against a running site.

Index

Constants

This section is empty.

Variables

Actions lists what a step can do, in the order help shows them: the actions of "plugyard exec", then the commands that power a charger on and off.

Functions

This section is empty.

Types

type Scenario

type Scenario struct {
	Name string
	// Steps are in time order, which is also the order of the file.
	Steps []Step
}

Scenario is a scenario file.

func Load

func Load(path string) (*Scenario, error)

Load reads and validates the scenario file at path.

func Parse

func Parse(data []byte) (*Scenario, error)

Parse reads and validates the contents of a scenario file. When the file has several problems, the returned error lists all of them.

func (*Scenario) Duration

func (s *Scenario) Duration() time.Duration

Duration returns the time of the last step.

type Step

type Step struct {
	// Number is the step's position in the scenario, counting from 1.
	Number int
	// At is when the step runs, counted from the start of the run.
	At time.Duration
	// Charger is a charge point ID, a name, or a pattern.
	Charger string
	// Do is the action, one of Actions.
	Do string
	// Request holds the action with its options, for the actions of
	// "plugyard exec". Its list of chargers is filled in when the step runs.
	Request control.ExecRequest
}

Step is one timed action.

func (Step) Describe

func (s Step) Describe() string

Describe returns the action with its options as it would be typed after "plugyard exec <charger>".

func (Step) Power

func (s Step) Power() bool

Power reports whether the step powers chargers on or off, as "plugyard start", "stop", "restart" and "kill" do.

Jump to

Keyboard shortcuts

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