actions

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewActionsEvaluator added in v0.27.0

func NewActionsEvaluator(engine core.IEngine, store ostore.IObjectStore) *eval

func ReadScenario added in v0.6.0

func ReadScenario(source string) (*spec.ScenarioDoc, error)

ReadScenario reads a scenario from file.

Types

type ActionHandler added in v0.6.0

type ActionHandler func(symbol string, args map[string]any) (any, error)

type Engine

type Engine struct {
	core.EventNotifier
	// contains filtered or unexported fields
}

func NewEngine added in v0.6.0

func NewEngine(store ostore.IObjectStore) *Engine

func (*Engine) ActiveScenarios added in v0.34.0

func (e *Engine) ActiveScenarios() []string

func (*Engine) GetInterface added in v0.6.0

func (e *Engine) GetInterface(ifaceId string) *spec.InterfaceEntry

func (*Engine) GetPlayer added in v0.26.3

func (e *Engine) GetPlayer(name string) *Player

GetPlayer returns the player with the given name

func (*Engine) GetProperties added in v0.6.0

func (e *Engine) GetProperties(symbol string) (map[string]any, error)

FetchProperties returns a copy of the properties of the interface.

func (*Engine) HasInterface added in v0.6.0

func (e *Engine) HasInterface(ifaceId string) bool

func (*Engine) HasSequence added in v0.6.0

func (e *Engine) HasSequence(name string) bool

func (*Engine) InvokeOperation added in v0.6.0

func (e *Engine) InvokeOperation(ifaceId string, opName string, args []any) (any, error)

InvokeOperation invokes a operation of the interface.

func (*Engine) LoadScenario added in v0.6.0

func (e *Engine) LoadScenario(source string, doc *spec.ScenarioDoc) error

func (*Engine) PlayAllSequences added in v0.8.0

func (e *Engine) PlayAllSequences(ctx context.Context) error

func (*Engine) PlaySequence added in v0.6.0

func (e *Engine) PlaySequence(ctx context.Context, name string) error

func (*Engine) ScenarioBySource added in v0.26.3

func (e *Engine) ScenarioBySource(source string) *ScenarioEntry

ScenarioBySource returns the scenario with the given source

func (*Engine) SetProperties added in v0.6.0

func (e *Engine) SetProperties(symbol string, props map[string]any) error

SetProperties updates the properties of the interface.

func (*Engine) StopAllSequences added in v0.8.0

func (e *Engine) StopAllSequences()

func (*Engine) StopSequence added in v0.8.0

func (e *Engine) StopSequence(name string) error

func (*Engine) UnloadScenario added in v0.8.0

func (a *Engine) UnloadScenario(source string) error

type PlayFrame added in v0.8.0

type PlayFrame struct {
	Action    spec.ActionEntry
	Interface *spec.InterfaceEntry
}

type Player added in v0.8.0

type Player struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Player is a player for one sequence It plays the sequence and sends the actions to the stream The stream is closed when the sequence is finished Actions are evaluated in the context of an interface

func NewPlayer added in v0.8.0

func NewPlayer(e *Engine, iface *spec.InterfaceEntry, seq *spec.SequenceEntry) *Player

NewPlayer creates a new sequence player

func (*Player) Play added in v0.8.0

func (p *Player) Play(ctx context.Context) error

Play starts the sequence It runs the sequence in a goroutine

func (*Player) SequenceName added in v0.8.0

func (p *Player) SequenceName() string

SequenceName returns the name of the sequence

func (*Player) Stop added in v0.8.0

func (p *Player) Stop() error

Stop stops the play loop

type ScenarioEntry added in v0.26.3

type ScenarioEntry struct {
	Source  string
	Doc     *spec.ScenarioDoc
	Players []*Player
}

Jump to

Keyboard shortcuts

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