Documentation ¶
Index ¶
- Variables
- type ActorConfig
- type Config
- type Receptor
- func (r *Receptor) Init(cfg *Config) error
- func (r *Receptor) Setup(cfg *Config) ([]*Service, error)
- func (r *Receptor) SetupGlobalConfig(cfg *Config) error
- func (r *Receptor) SetupReactor(cfg ActorConfig) (pipe.Endpoint, error)
- func (r *Receptor) SetupService(name string, cfg ServiceConfig) (*Service, error)
- func (r *Receptor) SetupServices(serviceCfgs map[string]ServiceConfig) ([]*Service, error)
- func (r *Receptor) SetupWatcher(cfg ActorConfig) (pipe.Endpoint, error)
- func (r *Receptor) Start()
- func (r *Receptor) Stop()
- type Service
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SERVICE_STOP_TIMEOUT = 5 * time.Second // Timeout for EACH service to cleanup PLUGIN_STOP_TIMEOUT = 5 * time.Second // Timeout for EACH plugin process to cleanup )
Functions ¶
This section is empty.
Types ¶
type ActorConfig ¶
type ActorConfig struct { Type string `json:"type"` Config json.RawMessage `json:"cfg"` }
type Config ¶
type Config struct { Services map[string]ServiceConfig `json:"services"` Watchers map[string]json.RawMessage `json:"watchers"` Reactors map[string]json.RawMessage `json:"reactors"` }
func NewConfigFromFile ¶
type Receptor ¶
type Receptor struct { Services []*Service PluginLookup plugin.LookupService DoneCh chan struct{} // Is closed if all service components are shut down FailureCh chan struct{} // Is closed if a service fails }
func NewReceptor ¶
func NewReceptor(lookup plugin.LookupService) *Receptor
func (*Receptor) SetupGlobalConfig ¶
SetupGlobalConfig configures watchers and reactors with their global config. Only setup watchers/reactors used by services.
func (*Receptor) SetupReactor ¶
func (r *Receptor) SetupReactor(cfg ActorConfig) (pipe.Endpoint, error)
SetupReactor registers a reactor with the service specific config.
func (*Receptor) SetupService ¶
func (r *Receptor) SetupService(name string, cfg ServiceConfig) (*Service, error)
SetupService sets up all watchers and reactors of the service with their service specific configuration.
func (*Receptor) SetupServices ¶
func (r *Receptor) SetupServices(serviceCfgs map[string]ServiceConfig) ([]*Service, error)
SetupServices sets up multiple services and their components defined by their service config.
func (*Receptor) SetupWatcher ¶
func (r *Receptor) SetupWatcher(cfg ActorConfig) (pipe.Endpoint, error)
SetupWatcher registers a watcher with the service specific config.
type Service ¶
type Service struct { DoneCh chan struct{} // Is closed if all service components are shut down FailureCh chan struct{} // Is closed if a failure occurs // contains filtered or unexported fields }
func NewService ¶
func (*Service) AddReactorEndpoint ¶
func (s *Service) AddReactorEndpoint(name string, endpoint *pipe.ManagedEndpoint)
func (*Service) AddWatcherEndpoint ¶
func (s *Service) AddWatcherEndpoint(name string, endpoint *pipe.ManagedEndpoint)
func (*Service) Shutdown ¶
func (s *Service) Shutdown()
Shutdown sends a stop signal to all watchers and reactors. Does not block.
type ServiceConfig ¶
type ServiceConfig struct { // Map unique user-defined name to actor config Watchers map[string]ActorConfig `json:"watchers"` Reactors map[string]ActorConfig `json:"reactors"` }
Click to show internal directories.
Click to hide internal directories.