Documentation
¶
Index ¶
- Constants
- type Config
- type Env
- type Plugin
- func (p *Plugin) Available()
- func (p *Plugin) CmdFactory(env Env) func() *exec.Cmd
- func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error
- func (p *Plugin) Name() string
- func (p *Plugin) NewWorker(ctx context.Context, env Env, listeners ...events.Listener) (*worker.Process, error)
- func (p *Plugin) NewWorkerPool(ctx context.Context, opt *pool.Config, env Env, listeners ...events.Listener) (pool.Pool, error)
- func (p *Plugin) Serve() chan error
- func (p *Plugin) Stop() error
- type Server
Constants ¶
View Source
const ( // PluginName for the server PluginName = "server" // RrRelay env variable key (internal) RrRelay = "RR_RELAY" // RrRPC env variable key (internal) if the RPC presents RrRPC = "RR_RPC" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Server config section
Server struct {
// Command to run as application.
Command string `mapstructure:"command"`
// User to run application under.
User string `mapstructure:"user"`
// Group to run application under.
Group string `mapstructure:"group"`
// Env represents application environment.
Env Env `mapstructure:"env"`
// Relay 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 `mapstructure:"relay"`
// 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 `mapstructure:"relay_timeout"`
} `mapstructure:"server"`
// we just need to know if the section exist, we don't need to read config from it
RPC *struct {
Listen string `mapstructure:"listen"`
} `mapstructure:"rpc"`
Logs *struct {
} `mapstructure:"logs"`
HTTP *struct {
} `mapstructure:"http"`
Redis *struct {
} `mapstructure:"redis"`
Boltdb *struct {
} `mapstructure:"boltdb"`
Memcached *struct {
} `mapstructure:"memcached"`
Memory *struct {
} `mapstructure:"memory"`
Metrics *struct {
} `mapstructure:"metrics"`
Reload *struct {
} `mapstructure:"reload"`
}
Config All config (.rr.yaml) For other section use pointer to distinguish between `empty` and `not present`
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin manages worker
func (*Plugin) CmdFactory ¶
CmdFactory provides worker command factory associated with given context.
func (*Plugin) NewWorker ¶
func (p *Plugin) NewWorker(ctx context.Context, env Env, listeners ...events.Listener) (*worker.Process, error)
NewWorker issues new standalone worker.
func (*Plugin) NewWorkerPool ¶
func (p *Plugin) NewWorkerPool(ctx context.Context, opt *pool.Config, env Env, listeners ...events.Listener) (pool.Pool, error)
NewWorkerPool issues new worker pool.
type Server ¶
type Server interface {
// CmdFactory return a new command based on the .rr.yaml server.command section
CmdFactory(env Env) func() *exec.Cmd
// NewWorker return a new worker with provided and attached by the user listeners and environment variables
NewWorker(ctx context.Context, env Env, listeners ...events.Listener) (*worker.Process, error)
// NewWorkerPool return new pool of workers (PHP) with attached events listeners, env variables and based on the provided configuration
NewWorkerPool(ctx context.Context, opt *pool.Config, env Env, listeners ...events.Listener) (pool.Pool, error)
}
Server creates workers for the application.
Click to show internal directories.
Click to hide internal directories.