manager

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package manager implements the component manager

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface {
	// Init initializes the component and prepares it for execution.
	Init(context.Context) error
	// Start starts the component.
	Start(context.Context) error
	// Stop stops this component, potentially cleaning up any temporary
	// resources attached to it.
	Stop() error
}

Component defines the lifecycle of managed components.

type Manager

type Manager struct {
	Components        []Component
	ReadyWaitDuration time.Duration
	// contains filtered or unexported fields
}

Manager manages components

func New

func New() *Manager

New creates a manager.

func (*Manager) Add

func (m *Manager) Add(component Component)

Add adds a component to the manager.

func (*Manager) Init

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

Init initializes all managed components.

func (*Manager) Start

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

Start starts all managed components.

func (*Manager) Stop

func (m *Manager) Stop() error

Stop stops all managed components.

type Ready

type Ready interface {
	// Ready performs a ready check and indicates that a component is ready to run.
	Ready() error
}

Ready is the interface for a component that can be checked for readiness.

Jump to

Keyboard shortcuts

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