component

package
v0.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Initer added in v0.6.3

type Initer interface {
	Init(ctx context.Context) error
}

Initer interface provides method to init a component. During initialization components may NOT be ready. Only safe methods (e.g. not dependant on other components) can be called during initialization.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager provide methods to manage components lifecycle

func NewManager added in v0.7.5

func NewManager(parent *Manager) *Manager

NewManager creates new component manager

func (*Manager) Init added in v0.6.3

func (m *Manager) Init(ctx context.Context) error

Init invokes Init method of all components which implements Initer interface

func (*Manager) Inject added in v0.6.3

func (m *Manager) Inject(components ...interface{})

Inject components in Manager and inject required dependencies Inject can inject interfaces only, tag public struct fields with `inject:""`

func (*Manager) Register

func (m *Manager) Register(components ...interface{})

Register components in Manager and inject required dependencies. Register can inject interfaces only, tag public struct fields with `inject:""`. If the injectable struct already has a value on the tagged field, the value WILL NOT be overridden.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start invokes Start method of all components which implements Starter interface

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

Stop invokes Stop method of all components which implements Starter interface

type Starter

type Starter interface {
	Start(ctx context.Context) error
}

Starter interface provides method to start a component.

type Stopper

type Stopper interface {
	Stop(ctx context.Context) error
}

Stopper interface provides method to stop a component.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL