app

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Time to sleep during main loop so we're a nice neighbour.
	EventLoopSleep time.Duration = 250 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig added in v0.3.0

type AppConfig struct {
}

type Application

type Application struct {
	Name    string         // Application name.
	Version *semver.SemVer // Version string.

	OnStart  OnSignalFn // Function called on app startup.
	OnExit   OnSignalFn // Function called on app exit.
	OnHUP    OnSignalFn // Function called when SIGHUP received.
	OnUSR1   OnSignalFn // Function called when SIGUSR1 received.
	OnUSR2   OnSignalFn // Function called when SIGUSR2 received.
	OnWINCH  OnSignalFn // Function used when SIGWINCH received.
	OnCHLD   OnSignalFn // Function used when SIGCHLD received.
	MainLoop MainLoopFn // Application main loop function.
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(
	name string,
	version *semver.SemVer,
	alogger logger.ILogger,
	aprocmgr process.IManager,
	aconfig interface{},
	acnffns config.ValidatorsMap,
) *Application

Create a new application.

func (*Application) Configuration

func (app *Application) Configuration() *config.Config

func (*Application) Context

func (app *Application) Context() context.Context

Return the application's context.

func (*Application) Init

func (app *Application) Init()

func (*Application) IsDebug

func (app *Application) IsDebug() bool

Is the application using debug mode?

func (*Application) IsRunning

func (app *Application) IsRunning() bool

Is the application running?

func (*Application) Logger

func (app *Application) Logger() logger.ILogger

func (*Application) ProcessManager

func (app *Application) ProcessManager() process.IManager

func (*Application) Run

func (app *Application) Run()

Start the application.

func (*Application) SetMainLoop

func (app *Application) SetMainLoop(fn MainLoopFn)

Set the main loop callback.

func (*Application) SetOnCHLD added in v0.3.0

func (app *Application) SetOnCHLD(fn OnSignalFn)

Set the `OnCHLD` callback.

func (*Application) SetOnExit

func (app *Application) SetOnExit(fn OnSignalFn)

Set the `OnExit` callback.

func (*Application) SetOnHUP

func (app *Application) SetOnHUP(fn OnSignalFn)

Set the `OnHUP` callback.

func (*Application) SetOnStart added in v0.3.0

func (app *Application) SetOnStart(fn OnSignalFn)

Set the `OnStart` callback.

func (*Application) SetOnUSR1

func (app *Application) SetOnUSR1(fn OnSignalFn)

Set the `OnUSR1` callback.

func (*Application) SetOnUSR2

func (app *Application) SetOnUSR2(fn OnSignalFn)

Set the `OnUSR2` callback.

func (*Application) SetOnWINCH

func (app *Application) SetOnWINCH(fn OnSignalFn)

Set the `OnWINCH` callback.

func (*Application) Terminate

func (app *Application) Terminate()

Stop the application.

type MainLoopFn

type MainLoopFn func(*Application) // Main loop callback function.

type OnSignalFn

type OnSignalFn func(*Application) // Signal callback function.

Jump to

Keyboard shortcuts

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