lifecyclejoin

package
v1.0.0-beta.161 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package lifecyclejoin owns the private, generation-scoped mechanics shared by SemStreams lifecycle implementations. It is internal framework plumbing, not an adopter-facing lifecycle API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunPartialStartRollback

func RunPartialStartRollback(rollback func(context.Context) error) error

RunPartialStartRollback synchronously undoes resources allocated by a failed Start under the one approved, bounded framework-owned root. No independent Stop caller exists for an uncommitted generation.

Types

type Generation

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

Generation coordinates one Start-owned runtime generation. It stores only cancellation, completion, and terminal result authority; it never retains a context.

func NewGeneration

func NewGeneration(cancel context.CancelFunc, wait func()) *Generation

NewGeneration publishes Start-owned completion for a fixed join set. Add all fixed goroutines before calling it. Protocol callback completion belongs to the protocol's native drain or shutdown authority, not this join.

func (*Generation) Cancel

func (g *Generation) Cancel()

Cancel signals the generation lifetime exactly once. Components whose servers require a context-bound pre-join Shutdown call use this before that call, then enter Stop to join the same generation.

func (*Generation) Signal

func (g *Generation) Signal(signal func() error) error

Signal cancels the generation and runs an immediate, context-free shutdown signal exactly once. It is useful for protocol shutdown signals that must precede a context-bound join.

func (*Generation) Stop

func (g *Generation) Stop(
	ctx context.Context,
	signal func() error,
	cleanup func(context.Context) error,
) error

Stop signals generation cancellation and component-specific shutdown once, joins Start-owned work under ctx, and runs terminal cleanup once. A context expiry leaves shared completion open so a later authorized Stop can finish.

type Operation

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

Operation coordinates one context-bound protocol shutdown operation. The executing caller runs the operation synchronously; concurrent callers join its result. Context expiry leaves the operation available for a later caller with a fresh Stop budget.

func NewOperation

func NewOperation() *Operation

NewOperation creates a protocol shutdown operation join.

func (*Operation) Run

func (o *Operation) Run(ctx context.Context, op func(context.Context) error) error

Run executes or joins op under ctx. A context-bound result remains resumable; every other result is retained and replayed.

Jump to

Keyboard shortcuts

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