ctxkit

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package ctxkit provides small context helpers shared between celeris root-package and sub-packages that cannot import the root due to circular-dependency constraints.

Index

Constants

This section is empty.

Variables

View Source
var ReleaseContext func(c any)

ReleaseContext is registered by the celeris package at init time. internal/conn/h1.go uses it to release cached contexts on connection close.

Functions

func WithWorkerID added in v1.4.0

func WithWorkerID(ctx context.Context, id int) context.Context

WithWorkerID annotates ctx with the event-loop worker ID that owns the connection. Engines call this at accept-time so per-request handlers can thread the worker affinity through driver calls without the engines and the celeris root package coupling directly.

id is the worker's numeric ID (0..NumWorkers-1). A worker ID of -1 means no meaningful worker identity (e.g. the std engine where Go's scheduler picks the goroutine).

func WorkerIDFrom added in v1.4.0

func WorkerIDFrom(ctx context.Context) (int, bool)

WorkerIDFrom extracts the engine worker ID stored by WithWorkerID. Returns (-1, false) when the context carries no annotation (synthetic contexts, tests without a Server, etc.).

Types

This section is empty.

Jump to

Keyboard shortcuts

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