lifecycle

package
v0.1.0-preview.4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package lifecycle defines canonical descriptors for generated application lifecycle callbacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnStart

func OnStart() sdk.Definition

OnStart marks a provider-owned method that runs after dependency construction and before the application becomes ready.

The exact method signature is func(context.Context) error. Callbacks start dependency-first. A failure rolls back already-started callbacks and constructed providers in reverse deterministic order.

// @import { OnStart } from "github.com/spice-framework/spice/annotation/lifecycle"
// @OnStart
func (*Server) Start(context.Context) error

func OnStartHandler

func OnStartHandler(
	_ context.Context,
	invocation sdk.Invocation,
) (sdk.Result, error)

OnStartHandler contributes a dependency-ordered start callback.

func OnStop

func OnStop() sdk.Definition

OnStop marks a provider-owned method that runs during graceful shutdown.

The exact method signature is func(context.Context) error. Callbacks run in reverse dependency order before construction cleanups. Stop is idempotent and uses the caller-owned shutdown context.

// @import { OnStop } from "github.com/spice-framework/spice/annotation/lifecycle"
// @OnStop
func (*Server) Stop(context.Context) error

func OnStopHandler

func OnStopHandler(
	_ context.Context,
	invocation sdk.Invocation,
) (sdk.Result, error)

OnStopHandler contributes a reverse-dependency stop callback.

Types

This section is empty.

Jump to

Keyboard shortcuts

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