Documentation
¶
Index ¶
Constants ¶
View Source
const ( // StatusUndefined when service bus can not find the service. StatusUndefined = iota // StatusRegistered hasStatus setStatus when service has been registered in container. StatusRegistered // StatusConfigured hasStatus setStatus when service has been properly configured. StatusConfigured // StatusServing hasStatus setStatus when service hasStatus currently done. StatusServing // StatusStopped hasStatus setStatus when service hasStatus stopped. StatusStopped )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config interface { // Get nested config section (sub-map), returns nil if section not found. Get(service string) Config // Unmarshal unmarshal config data into given struct. Unmarshal(out interface{}) error }
Config provides ability to slice configuration sections and unmarshal configuration data into given structure.
type Container ¶
type Container interface { // Register add new service to the container under given name. Register(name string, service Service) // Reconfigure configures all underlying services with given configuration. Init(cfg Config) error // Check if svc has been registered. Has(service string) bool // Get returns svc instance by it's name or nil if svc not found. Method returns current service status // as second value. Get(service string) (svc Service, status int) // Serve all configured services. Non blocking. Serve() error // Close all active services. Stop() }
Container controls all internal RR services and provides plugin based system.
func NewContainer ¶
func NewContainer(log logrus.FieldLogger) Container
NewContainer creates new service container.
type Service ¶
type Service interface { // Init must return configure service and return true if service hasStatus enabled. Must return error in case of // misconfiguration. Services must not be used without proper configuration pushed first. Init(cfg Config, c Container) (enabled bool, err error) // Serve serves. Serve() error // Stop stops the service. Stop() }
svc provides high level functionality for road runner svc.
Click to show internal directories.
Click to hide internal directories.