app

package
v2.0.0-alpha17 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "app"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Command to run as application.
	Command string

	// User to run application under.
	User string

	// Group to run application under.
	Group string

	// Env represents application environment.
	Env Env

	// Listen defines connection method and factory to be used to connect to workers:
	// "pipes", "tcp://:6001", "unix://rr.sock"
	// This config section must not change on re-configuration.
	Relay string

	// RelayTimeout defines for how long socket factory will be waiting for worker connection. This config section
	// must not change on re-configuration. Defaults to 60s.
	RelayTimeout time.Duration
}

Config config combines factory, pool and cmd configurations.

func (*Config) InitDefaults

func (cfg *Config) InitDefaults()

type Env

type Env map[string]string

type Plugin

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

Plugin manages worker

func (*Plugin) CmdFactory

func (app *Plugin) CmdFactory(env Env) (func() *exec.Cmd, error)

CmdFactory provides worker command factory assocated with given context.

func (*Plugin) Init

func (app *Plugin) Init(cfg config.Configurer, log log.Logger) error

Init application provider.

func (*Plugin) Name

func (app *Plugin) Name() string

Name contains service name.

func (*Plugin) NewWorker

func (app *Plugin) NewWorker(ctx context.Context, env Env) (roadrunner.WorkerBase, error)

NewWorker issues new standalone worker.

func (*Plugin) NewWorkerPool

func (app *Plugin) NewWorkerPool(ctx context.Context, opt roadrunner.Config, env Env) (roadrunner.Pool, error)

NewWorkerPool issues new worker pool.

func (*Plugin) Serve

func (app *Plugin) Serve() chan error

func (*Plugin) Stop

func (app *Plugin) Stop() error

type WorkerFactory

type WorkerFactory interface {
	CmdFactory(env Env) (func() *exec.Cmd, error)
	NewWorker(ctx context.Context, env Env) (roadrunner.WorkerBase, error)
	NewWorkerPool(ctx context.Context, opt roadrunner.Config, env Env) (roadrunner.Pool, error)
}

WorkerFactory creates workers for the application.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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