Summary
Create a standalone mini event loop that database/cache drivers use when no celeris HTTP server is running. This enables drivers to work independently while still using efficient I/O.
Design
Package: driver/internal/eventloop/
driver/internal/eventloop/
loop_linux.go # Standalone mini epoll/iouring loop
loop_other.go # Fallback: goroutine-per-conn via net.Conn
registry.go # Engine sharing registry
loop_linux.go
- Stripped-down epoll loop (no accept, no HTTP detection, no protocol parsing)
- Manages only DB/cache socket FDs
- Implements the same
WorkerLoop interface as the full engines
- Single-worker by default, configurable via
WithWorkers(n)
- Clean shutdown: drains pending operations, closes all FDs
loop_other.go (non-Linux fallback)
- Goroutine-per-connection using
net.Conn
- Wraps
net.Conn read loop to match WorkerLoop callback semantics
- Acceptable performance loss on non-Linux (development/testing)
registry.go
- Global registry where a celeris
Server registers its engine as an EventLoopProvider
- Drivers check registry first — if a provider exists, use integrated mode; otherwise spawn standalone loop
- Thread-safe with
sync.RWMutex
Acceptance Criteria
Summary
Create a standalone mini event loop that database/cache drivers use when no celeris HTTP server is running. This enables drivers to work independently while still using efficient I/O.
Design
Package:
driver/internal/eventloop/loop_linux.goWorkerLoopinterface as the full enginesWithWorkers(n)loop_other.go(non-Linux fallback)net.Connnet.Connread loop to matchWorkerLoopcallback semanticsregistry.goServerregisters its engine as anEventLoopProvidersync.RWMutexAcceptance Criteria
loop_linux.go: functional epoll mini-loop withWorkerLoopinterfaceloop_other.go: goroutine-per-conn fallback compiles on macOS/Windowsregistry.go: engine sharing registry with register/lookup/deregisterengine/interfaces)