Documentation
¶
Index ¶
- Constants
- func Stop(name string, pid int) error
- func WaitForSignal()
- type LauncherService
- func (svc *LauncherService) List(ctx hubclient.ServiceContext, args launcherapi.ListArgs) (launcherapi.ListResp, error)
- func (svc *LauncherService) ScanPlugins() error
- func (svc *LauncherService) Start() error
- func (svc *LauncherService) StartAllPlugins() (err error)
- func (svc *LauncherService) StartPlugin(ctx hubclient.ServiceContext, args launcherapi.StartPluginArgs) (launcherapi.StartPluginResp, error)
- func (svc *LauncherService) Stop() error
- func (svc *LauncherService) StopAllPlugins(ctx hubclient.ServiceContext, args *launcherapi.StopAllPluginsArgs) (err error)
- func (svc *LauncherService) StopPlugin(ctx hubclient.ServiceContext, args launcherapi.StopPluginArgs) (resp launcherapi.StopPluginResp, err error)
- func (svc *LauncherService) WatchPlugins() error
Constants ¶
const CoreID = "core"
CoreID The core has a predefined ID
Variables ¶
This section is empty.
Functions ¶
func Stop ¶
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 ¶
func (svc *LauncherService) List( ctx hubclient.ServiceContext, args launcherapi.ListArgs) (launcherapi.ListResp, error)
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 ¶
func (svc *LauncherService) StartPlugin(ctx hubclient.ServiceContext, args launcherapi.StartPluginArgs) (launcherapi.StartPluginResp, error)
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 (svc *LauncherService) StopPlugin( ctx hubclient.ServiceContext, args launcherapi.StopPluginArgs) (resp launcherapi.StopPluginResp, err error)
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.