service

package
v0.0.0-...-147f0cf Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CoreID = "core"

CoreID The core has a predefined ID

Variables

This section is empty.

Functions

func Stop

func Stop(name string, pid int) error

Stop a process, wait until timeout This first tries using SIGTERM. If the timeout expires then try Kill. If kill also fails then return an error. Returns nil if the process is not running after the timeout This returns an error when the process fails to stop after the timeout.

func WaitForSignal

func WaitForSignal()

WaitForSignal waits until a TERM or INT signal is received Intended for use by hub plugins to run until the app is done

Types

type LauncherService

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

LauncherService manages starting and stopping of plugins This implements the ILauncher interface

func NewLauncherService

func NewLauncherService(
	env utils.AppEnvironment,
	cfg config.LauncherConfig,
	hc *hubclient.HubClient,
) *LauncherService

NewLauncherService returns a new launcher instance for the plugins in the given plugins folder. This scans the folder for executables, adds these to the list of available plugins and autostarts plugins Logging will be enabled based on LauncherConfig.

The hub client is intended when an existing message bus is used. If the core is started by the launcher then it is ignored.

func (*LauncherService) List

List all available or just the running plugins and their status This returns the list of plugins sorted by name

func (*LauncherService) ScanPlugins

func (svc *LauncherService) ScanPlugins() error

ScanPlugins scans the plugin folder for changes and updates the plugins list

func (*LauncherService) Start

func (svc *LauncherService) Start() error

Start the launcher service This first starts the core defined in the config, then connects to the hub to be able to create auth keys and tokens, and to subscribe to rpc requests.

Call stop to end

func (*LauncherService) StartAllPlugins

func (svc *LauncherService) StartAllPlugins() (err error)

StartAllPlugins starts all enabled plugins

func (*LauncherService) StartPlugin

StartPlugin starts the plugin with the given name This creates a plugin authentication key and token files in the credentials directory (certs) before starting the plugin.

func (*LauncherService) Stop

func (svc *LauncherService) Stop() error

Stop the launcher and all running plugins

func (*LauncherService) StopAllPlugins

func (svc *LauncherService) StopAllPlugins(ctx hubclient.ServiceContext,
	args *launcherapi.StopAllPluginsArgs) (err error)

StopAllPlugins stops all running plugins in reverse order they were started If includingCore is set then also stop the core.

func (*LauncherService) StopPlugin

func (*LauncherService) WatchPlugins

func (svc *LauncherService) WatchPlugins() error

WatchPlugins watches the bin and plugins folder for changes and reloads This will detect adding new plugins without requiring a restart.

Jump to

Keyboard shortcuts

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