Documentation
¶
Overview ¶
Package scriptsrv owns the scripting executor that runs pre/post-request scripts: it starts, stops and restarts it, and reports its state.
Index ¶
- type Service
- func (s *Service) Execute(ctx context.Context, script string, params *scripting.ExecParams) (*scripting.ExecResult, error)
- func (s *Service) Restart(cfg domain.ScriptingConfig)
- func (s *Service) SetWake(fn func())
- func (s *Service) Shutdown()
- func (s *Service) State() (State, error)
- func (s *Service) Status() string
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service runs one executor at a time. Starting one can take long (a Docker image pull), so Restart works in the background and reports progress through Status and the wake function.
func (*Service) Execute ¶
func (s *Service) Execute(ctx context.Context, script string, params *scripting.ExecParams) (*scripting.ExecResult, error)
Execute runs script on the running executor.
func (*Service) Restart ¶
func (s *Service) Restart(cfg domain.ScriptingConfig)
Restart stops the executor and, when cfg enables scripting, starts it again with cfg, even when cfg is what it already runs. It returns at once; the work runs in the background.
func (*Service) SetWake ¶
func (s *Service) SetWake(fn func())
SetWake sets the function that requests a repaint. Safe from any goroutine.
func (*Service) Shutdown ¶
func (s *Service) Shutdown()
Shutdown stops the executor. It is for app exit, so it does not wait out a start in progress (a Docker pull can take minutes); it leaves that one.