Documentation ¶
Index ¶
- func Register(name string, spec *Spec)
- func RegisterProvider(name string, define ProviderDefine)
- func Usage(names ...string) string
- func WithListener(l Listener) interface{}
- func WithLogger(logger logs.Logger) interface{}
- type ConfigCreator
- type Context
- type Creator
- type DefaultListener
- type DependencyContext
- type DependencyProvider
- type Events
- type FixedServiceDependencies
- type Hub
- func (h *Hub) Close() error
- func (h *Hub) Events() Events
- func (h *Hub) ForeachServices(fn func(service string) bool)
- func (h *Hub) Init(config map[string]interface{}, flags *pflag.FlagSet, args []string) (err error)
- func (h *Hub) IsServiceExist(service string) bool
- func (h *Hub) Provider(name string) interface{}
- func (h *Hub) Run(name, cfgfile string, args ...string)
- func (h *Hub) RunWithOptions(opts *RunOptions)
- func (h *Hub) Service(name string, options ...interface{}) interface{}
- func (h *Hub) Start(closer ...<-chan os.Signal) (err error)
- func (h *Hub) StartWithSignal() error
- type Listener
- type Option
- type OptionalServiceDependencies
- type Provider
- type ProviderDefine
- type ProviderInitializer
- type ProviderRunner
- type ProviderRunnerWithContext
- type ProviderService
- type ProviderServices
- type ProviderUsage
- type ProviderUsageSummary
- type RunOptions
- type ServiceDependencies
- type ServiceTypes
- type Spec
- type TaskOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterProvider ¶
func RegisterProvider(name string, define ProviderDefine)
RegisterProvider .
Types ¶
type Context ¶
type Context interface { context.Context Hub() *Hub Config() interface{} Logger() logs.Logger Service(name string, options ...interface{}) interface{} AddTask(task func(context.Context) error, options ...TaskOption) Key() string Label() string Provider() Provider }
Context .
type DefaultListener ¶
type DefaultListener struct { BeforeInitFunc func(h *Hub, config map[string]interface{}) error AfterInitFunc func(h *Hub) error AfterStartFunc func(h *Hub) error BeforeExitFunc func(h *Hub, err error) error }
DefaultListener .
func (*DefaultListener) AfterInitialization ¶
func (l *DefaultListener) AfterInitialization(h *Hub) error
AfterInitialization .
func (*DefaultListener) AfterStart ¶
func (l *DefaultListener) AfterStart(h *Hub) error
AfterStart .
func (*DefaultListener) BeforeExit ¶
func (l *DefaultListener) BeforeExit(h *Hub, err error) error
BeforeExit .
func (*DefaultListener) BeforeInitialization ¶
func (l *DefaultListener) BeforeInitialization(h *Hub, config map[string]interface{}) error
BeforeInitialization .
type DependencyContext ¶
type DependencyContext interface { Type() reflect.Type Tags() reflect.StructTag Service() string Key() string Label() string Caller() string }
DependencyContext .
type DependencyProvider ¶
type DependencyProvider interface {
Provide(ctx DependencyContext, options ...interface{}) interface{}
}
DependencyProvider .
type FixedServiceDependencies ¶
type FixedServiceDependencies interface {
Dependencies() []string
}
FixedServiceDependencies deprecated, use ServiceDependencies instead.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub .
func (*Hub) ForeachServices ¶
ForeachServices .
type Listener ¶
type Listener interface { BeforeInitialization(h *Hub, config map[string]interface{}) error AfterInitialization(h *Hub) error AfterStart(h *Hub) error BeforeExit(h *Hub, err error) error }
Listener .
type OptionalServiceDependencies ¶
OptionalServiceDependencies deprecated, use ServiceDependencies instead.
type ProviderInitializer ¶
ProviderInitializer .
type ProviderRunner ¶
ProviderRunner .
type ProviderRunnerWithContext ¶
ProviderRunnerWithContext .
type ProviderService ¶
type ProviderService interface {
Service() []string
}
ProviderService deprecated, use ProviderServices instead.
type ProviderUsageSummary ¶
type ProviderUsageSummary interface {
Summary() string
}
ProviderUsageSummary .
type RunOptions ¶
type RunOptions struct { Name string ConfigFile string Content interface{} Format string Args []string }
RunOptions .
type ServiceDependencies ¶
ServiceDependencies .
type Spec ¶
type Spec struct { Define interface{} // optional Services []string // optional Dependencies []string // optional OptionalDependencies []string // optional DependenciesFunc func(h *Hub) []string // optional Summary string // optional Description string // optional ConfigFunc func() interface{} // optional Types []reflect.Type // optional Creator Creator // required }
Spec define provider and register with Register function
Source Files ¶
Click to show internal directories.
Click to hide internal directories.