lifecycle

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lifecycle owns the plugin-level root context. Background work that must outlive an HTTP request or hook (LLM streaming, title generation, summarization) derives from Context() instead of context.Background() so that OnDeactivate can cancel all of it at once with ErrShutdown as the cause, letting streams distinguish a plugin shutdown from a user stop.

Index

Constants

This section is empty.

Variables

View Source
var ErrShutdown = errors.New("plugin is shutting down")

ErrShutdown is the cancellation cause attached to the root context when the plugin is deactivating.

Functions

func Context

func Context() context.Context

Context returns the current plugin root context. Before Start it is context.Background().

func IsShutdown

func IsShutdown(ctx context.Context) bool

IsShutdown reports whether ctx was canceled because the plugin is shutting down (as opposed to a user stop or request cancellation).

func Shutdown

func Shutdown()

Shutdown cancels the root context with ErrShutdown. Called from OnDeactivate. Safe to call when Start was never called.

func Start

func Start()

Start installs a fresh root context. Called from OnActivate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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