Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	OnStart func(context.Context) error
	OnStop  func(context.Context) error
	// contains filtered or unexported fields
}

    A Hook is a pair of start and stop callbacks, either of which can be nil, plus a string identifying the supplier of the hook.

    type Lifecycle

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

      Lifecycle coordinates application lifecycle hooks.

      func New

      func New(logger *fxlog.Logger) *Lifecycle

        New constructs a new Lifecycle.

        func (*Lifecycle) Append

        func (l *Lifecycle) Append(hook Hook)

          Append adds a Hook to the lifecycle.

          func (*Lifecycle) Start

          func (l *Lifecycle) Start(ctx context.Context) error

            Start runs all OnStart hooks, returning immediately if it encounters an error.

            func (*Lifecycle) Stop

            func (l *Lifecycle) Stop(ctx context.Context) error

              Stop runs any OnStop hooks whose OnStart counterpart succeeded. OnStop hooks run in reverse order.

              Source Files