components

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

func (*Base) AddDependencies

func (b *Base) AddDependencies(deps ...string)

func (*Base) Dependencies

func (b *Base) Dependencies() map[string]Component

func (*Base) Dependency

func (b *Base) Dependency(name string) Component

func (*Base) Log

func (b *Base) Log(lvl zerolog.Level, message string, fields ...any)

func (*Base) Logger

func (b *Base) Logger() *zerolog.Logger

func (*Base) Name

func (b *Base) Name() string

func (*Base) SetDependency

func (b *Base) SetDependency(c Component)

func (*Base) SetLogger

func (b *Base) SetLogger(l *zerolog.Logger)

func (*Base) SetName

func (b *Base) SetName(name string)

type Component

type Component interface {
	Configure(...Option) error
	Start() error
	Shutdown() error

	SetName(string)
	Name() string

	AddDependencies(...string)
	SetDependency(Component)
	Dependency(string) Component
	Dependencies() map[string]Component

	SetLogger(*zerolog.Logger)
	Logger() *zerolog.Logger
	Log(zerolog.Level, string, ...any)
}

type Option

type Option interface {
	Apply(Component) error
}

func WithLogger

func WithLogger(log *zerolog.Logger) Option

type Orchestrator

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

func NewOrchestrator

func NewOrchestrator() *Orchestrator

func (*Orchestrator) Component

func (o *Orchestrator) Component(name string) Component

func (*Orchestrator) Configure

func (o *Orchestrator) Configure() error

func (*Orchestrator) OrderComponents

func (o *Orchestrator) OrderComponents() error

func (*Orchestrator) Register

func (o *Orchestrator) Register(c Component, opts ...Option)

func (*Orchestrator) Start

func (o *Orchestrator) Start() error

Jump to

Keyboard shortcuts

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