An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/aretw0/lifecycle

Package lifecycle provides a robust control plane for modern Go applications. It unifies Death Management (Signals, Shutdown) with Life Management (Supervision, Events). The library is built around three pillars: Signal Context (The Foundation): Manages the application's lifecycle, handling OS signals (SIGINT/SIGTERM) and propagating cancellation via context.Context. ctx := lifecycle.NewSignalContext(context.Background()) <-ctx.Done() Supervisor (The Bridge): Manages a tree of Workers (Processes, Containers, Goroutines), ensuring they adhere to the parent's lifecycle. It supports restart strategies (OneForOne, OneForAll), persistent identity (Handover), and state introspection via Workers(). sup := lifecycle.NewSupervisor("root", lifecycle.SupervisorStrategyOneForOne) sup.Add(spec) states := sup.Workers() Control Plane (The Orchestrator): Decouples "Events" (Triggers) from "Handlers" (Reactions) via a Router. This allows the application to react to external stimuli (Input, Webhooks) dynamically. router := lifecycle.NewRouter() router.Handle("signal/interrupt", handler) For convenience, this package exposes the most commonly used types and constructors from the internal `pkg/` structure, grouped by functionality: For CLI tools, use the Interactive Router preset to wire up signals and input automatically: Configuration is done via Functional Options (SignalOption) and Struct Specs (SupervisorSpec). We adopt the "Stdlib Pattern": providing a `DefaultRouter` for convenience ("Managed Global State") while allowing explicit `NewRouter` for strict isolation.

Ecosystem
proxy.golang.org
Latest Release
v1.7.2
12 days ago
Versions
21
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/aretw0/lifecycle
spec
License AGPL-3.0
Namespace github.com/aretw0
First Release about 1 month ago
Last Synced 1 day ago
Repository
Stars 1 on GitHub
Forks 0 on GitHub
Rankings on proxy.golang.org
Overall Top 1.0%