scriptsrv

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

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

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 New

func New() *Service

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.

func (*Service) State

func (s *Service) State() (State, error)

State reports what the executor is doing and, when it failed, why.

func (*Service) Status

func (s *Service) Status() string

Status describes the executor's state for the settings page.

type State

type State int
const (
	Stopped State = iota
	Starting
	Running
	Failed
)

Jump to

Keyboard shortcuts

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