lifecycle

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnFinish

func OnFinish(ctx context.Context, s interface{}, opt *LifecycleOptions)

func OnStart

func OnStart(ctx context.Context, s interface{}, opt *LifecycleOptions) error

Types

type LifecycleOptions

type LifecycleOptions struct {
	Env            definition.ServiceDeploy
	ExecuteOnTests bool
}

type ServiceLifecycleFinisher added in v0.13.0

type ServiceLifecycleFinisher interface {
	// OnFinish is the method called before the service is finished. Resources
	// should be released here.
	OnFinish(ctx context.Context)
}

ServiceLifecycleFinisher is an optional behavior that a service can have to receive notifications when the service is finishing.

type ServiceLifecycleStarter added in v0.13.0

type ServiceLifecycleStarter interface {
	// OnStart is a method called right before the service enters its (infinite)
	// execution mode, when Service.Start API is called. When called, all features
	// declared inside the main structure service are already initialized and
	// available to use.
	//
	// It is the right place for the service to initialize its external resources
	// or specific members from its main structure.
	OnStart(ctx context.Context) error
}

ServiceLifecycleStarter is an optional behavior that a service can have to receive notifications when the service is initializing.

Jump to

Keyboard shortcuts

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