Timeout and idle-state handlers for Gnalloy channels, backed by the core hashed wheel timer.
This module provides Pipeline handlers. A handler observes, transforms, rejects, delays, records, or protects messages after a Channel already exists. It does not own listening sockets or application protocols unless explicitly named.
- Import path:
gnalloy.org/handler-timeout - Repository:
github.com/gnalloy/handler-timeout - Default branch:
dev - Preview install:
go get gnalloy.org/handler-timeout@dev - License: Apache-2.0
go get gnalloy.org/handler-timeout@dev
go doc gnalloy.org/handler-timeout
GOWORK=off GOTOOLCHAIN=local go test ./... -count=1- Overview (中文)
- Usage (中文)
- Examples (中文)
- Configuration (中文)
- Testing and Performance (中文)
- API Reference (中文)
- Notes and Caveats (中文)
- ADR-001 Module Boundary (中文)
This repository owns: Timeout and idle-state handlers for Gnalloy channels, backed by the core hashed wheel timer.
It does not absorb neighboring module responsibilities. Core primitives stay in gnalloy.org/gnalloy; protocol codecs, transports, handlers, resolvers, examples, and benchmarks stay in their own repositories.
gnalloy.org/handler-timeout(timeout)
gnalloy.org/gnalloy
- Handler constructors usually carry the policy: limits, timeouts, match rules, logging level, recorder, or traffic budget.
- Handler order matters. Place protocol decoders before handlers that inspect protocol objects, and place outbound encoders after handlers that write protocol objects.
- Handlers must keep backpressure and message ownership explicit; never retain ByteBuf values without clear lifetime control.
The generated API reference lists the full public surface. Common constructors or option types currently include:
var ErrReadTimeout = errors.New("gnalloy/handler/timeout: read timeout") ...
GOWORK=off GOTOOLCHAIN=local go test ./... -count=1
GOWORK=off GOTOOLCHAIN=local go vet ./...
GOWORK=off GOTOOLCHAIN=local go test ./... -run '^$' -bench . -benchmem -count=1For pressure tests, assemble this module with the relevant transport, codec, and handler stack and run the scenario from gnalloy.org/benchmarks or gnalloy.org/examples. Keep host, operating system, payload, concurrency, warmup, and repetitions in the report.
- This repository is intentionally narrow. Cross-module behavior should be assembled in applications, recipes, examples, or benchmark harnesses.
- Public APIs should remain Go-native and explicit; avoid runtime scanning, hidden global registries, and reflection-heavy behavior in hot paths.
- Treat network input as untrusted. Configure parser limits and return typed errors instead of panics.
- Keep benchmark claims tied to a concrete host, operating system, protocol, payload, concurrency, warmup, and repetition count.
- Handler modules are reusable only when their position in the pipeline is correct for the messages they observe.