component

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(v interface{}) error

NewConfig creates a new instance of component Config

Types

type Component

type Component interface {
	// HasInitializer returns whether a service component has
	// an initializer defined. Every service component needs to define this method
	HasInitializer() bool
	// Initializer returns the initializer for the component
	Initializer() Initializer
}

type Initializer

type Initializer interface {
	// AddDependency adds the service component dependency
	// requested by a service component
	AddDependency(dep interface{}) error
	// CanRun returns whether the service component has a Run function defined
	CanRun() bool
	// Run - runs/starts the service components
	Run(ctx context.Context) error
	// Dependencies returns the list of string service component dependency names
	Dependencies() []string
	// CanStop returns whether the component is stoppable
	CanStop() bool
	// Stop - stops/closes the service components
	Stop(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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