app

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	IsRunning bool
	// contains filtered or unexported fields
}

Shutdown logic follows this example https://gist.github.com/akhenakh/38dbfea70dc36964e23acc19777f3869

func New

func New(cfg config.Config, env env.SpaceEnv) *App

func (*App) Run

func (a *App) Run(name string, component core.Component)

Run registers this component to be cleaned up on Shutdown

func (*App) RunAsync

func (a *App) RunAsync(name string, component core.AsyncComponent, fn func() error) error

RunAsync performs the same function as Run() but also accepts an function to be run async to initialize the component.

func (*App) Shutdown

func (a *App) Shutdown() error

Shutdown would perform a graceful shutdown of all components added through the Run() or RunAsync() functions

func (*App) Start

func (a *App) Start() error

Start is the Entry point for the app. All module components are initialized and managed here. When a top level module that need to be shutdown on exit is initialized. It should be added to the apps list of tracked components using the `Run()` function, but if the component has a blocking start/run function it should be tracked with the `RunAsync()` function and call the blocking function in the input function block.

Jump to

Keyboard shortcuts

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