Documentation ¶
Index ¶
- type ContainerAware
- type Service
- type ServiceContainer
- type ServiceRegistry
- func (reg *ServiceRegistry) GetService(id string) (interface{}, bool)
- func (reg *ServiceRegistry) PrepareShutdown()
- func (reg *ServiceRegistry) Ready() error
- func (reg *ServiceRegistry) RegisterService(id string, svc interface{})
- func (reg *ServiceRegistry) RegisterServices(services map[string]interface{})
- func (reg *ServiceRegistry) Shutdown()
- type ServiceWithPrepareShutdown
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerAware ¶
type ContainerAware interface {
SetContainer(c ServiceContainer)
}
ContainerAware is an interface for container-aware components
type ServiceContainer ¶
type ServiceContainer interface { Ready() error GetService(id string) (interface{}, bool) RegisterService(id string, svc interface{}) RegisterServices(services map[string]interface{}) PrepareShutdown() Shutdown() }
ServiceContainer is the service container interface
func NewContainer ¶
func NewContainer() ServiceContainer
NewContainer creates a new service container
type ServiceRegistry ¶
type ServiceRegistry struct {
// contains filtered or unexported fields
}
ServiceRegistry is a struct for keeping tabs on registered services
func (*ServiceRegistry) GetService ¶
func (reg *ServiceRegistry) GetService(id string) (interface{}, bool)
GetService fetches a service by its ID
func (*ServiceRegistry) PrepareShutdown ¶
func (reg *ServiceRegistry) PrepareShutdown()
PrepareShutdown prepares all services for eventual shutdown
func (*ServiceRegistry) Ready ¶
func (reg *ServiceRegistry) Ready() error
Ready starts up the service graph and returns error if it's not ready
func (*ServiceRegistry) RegisterService ¶
func (reg *ServiceRegistry) RegisterService(id string, svc interface{})
RegisterService registers a service
func (*ServiceRegistry) RegisterServices ¶
func (reg *ServiceRegistry) RegisterServices(services map[string]interface{})
RegisterServices registers multiple services
func (*ServiceRegistry) Shutdown ¶
func (reg *ServiceRegistry) Shutdown()
Shutdown shuts down all services
type ServiceWithPrepareShutdown ¶
type ServiceWithPrepareShutdown interface { Startup() PrepareShutdown() Shutdown() }
ServiceWithPrepareShutdown is the service interface with prepare shutdown method
Click to show internal directories.
Click to hide internal directories.