Documentation
¶
Index ¶
- Constants
- type Config
- type Configurer
- type InitConfig
- type NamedLogger
- type Plugin
- func (p *Plugin) GID() int
- func (p *Plugin) Init(cfg Configurer, log NamedLogger) error
- func (p *Plugin) Name() string
- func (p *Plugin) NewPool(ctx context.Context, cfg *pool.Config, env map[string]string, _ *zap.Logger) (*staticPool.Pool, error)
- func (p *Plugin) NewPoolWithOptions(ctx context.Context, cfg *pool.Config, env map[string]string, _ *zap.Logger, ...) (*staticPool.Pool, error)
- func (p *Plugin) NewWorker(ctx context.Context, env map[string]string) (*worker.Process, error)
- func (p *Plugin) Serve() chan error
- func (p *Plugin) Stop(_ context.Context) error
- func (p *Plugin) UID() int
- type Pool
- type RPCConfig
Constants ¶
View Source
const ( // PluginName for the server PluginName string = "server" // RPCPluginName is the name of the RPC plugin, should be in sync with rpc/config.go RPCPluginName string = "rpc" // RrRelay env variable key (internal) RrRelay string = "RR_RELAY" // RrRPC env variable key (internal) if the RPC presents RrRPC string = "RR_RPC" // RrVersion env variable RrVersion string = "RR_VERSION" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// OnInit configuration
OnInit *InitConfig `mapstructure:"on_init"`
// 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 map[string]string `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"`
}
Config All config (.rr.yaml) For other section use pointer to distinguish between `empty` and `not present`
func (*Config) InitDefaults ¶
InitDefaults for the server config
type Configurer ¶
type InitConfig ¶
type InitConfig struct {
// Command which is started before worker starts
Command []string `mapstructure:"command"`
// ExecTimeout is execute timeout for the command
ExecTimeout time.Duration `mapstructure:"exec_timeout"`
// Env represents application environment.
Env map[string]string `mapstructure:"env"`
// Env represents UID
User string `mapstructure:"user"`
// ExitOnError defines if the RR should exit if the command fails
ExitOnError bool `mapstructure:"exit_on_error"`
}
type NamedLogger ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin manages worker
func (*Plugin) Init ¶
func (p *Plugin) Init(cfg Configurer, log NamedLogger) error
Init application provider.
func (*Plugin) NewPool ¶
func (p *Plugin) NewPool(ctx context.Context, cfg *pool.Config, env map[string]string, _ *zap.Logger) (*staticPool.Pool, error)
NewPool issues new worker pool.
func (*Plugin) NewPoolWithOptions ¶ added in v5.2.1
type Pool ¶
type Pool interface {
// GetConfig returns pool configuration.
GetConfig() *pool.Config
// Workers return a worker list associated with the pool.
Workers() (workers []*worker.Process)
// RemoveWorker removes worker from the pool.
RemoveWorker(ctx context.Context) error
// AddWorker adds worker to the pool.
AddWorker() error
// Exec payload
Exec(ctx context.Context, p *payload.Payload, stopCh chan struct{}) (chan *staticPool.PExec, error)
// Reset kills all workers inside the watcher and replaces with new
Reset(ctx context.Context) error
// Destroy all underlying stacks (but let them complete the task).
Destroy(ctx context.Context)
}
Pool manager sets of inner worker processes.
Click to show internal directories.
Click to hide internal directories.