Skip to content

Repository files navigation

handler-timeout

简体中文 | Documentation

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.

Status

  • 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

Install

go get gnalloy.org/handler-timeout@dev
go doc gnalloy.org/handler-timeout
GOWORK=off GOTOOLCHAIN=local go test ./... -count=1

Documentation

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.

Packages

  • gnalloy.org/handler-timeout (timeout)

Gnalloy Dependencies

  • gnalloy.org/gnalloy

Common Integration Pattern

  • 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.

Current Public Entry Points

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") ...

Verification

GOWORK=off GOTOOLCHAIN=local go test ./... -count=1
GOWORK=off GOTOOLCHAIN=local go vet ./...
GOWORK=off GOTOOLCHAIN=local go test ./... -run '^$' -bench . -benchmem -count=1

For 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.

Caveats

  • 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.

About

Timeout and idle-state handlers for Gnalloy channels, backed by the core hashed wheel timer.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages