Adds kairos#298
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an async-backend switch in Prologue to enable a chronos-based runtime via the Kairos HTTP server, selectable through a Nimble feature or a compiler define. It updates core modules to import a new asyncbackend shim instead of asyncdispatch directly, and adds documentation plus example/benchmark files.
Changes:
- Add
src/prologue/core/asyncbackend.nimto centralize switching betweenasyncdispatch + httpx(default) andchronos(Kairos mode). - Update core/middleware/OpenAPI/websocket modules to import
asyncbackendand conditionally use Kairos-specific modules/types where needed. - Document the chronos/Kairos backend in the README and add new kairos-oriented examples/benchmarks.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/compile/test_readme/example_kairos.nim | Adds a Kairos-oriented “hello world” compile example. |
| tests/compile/test_readme/example_kairos_middleware.nim | Adds a Kairos-oriented middleware compile example. |
| tests/benchmark/b_logue_async.nim | Adds an asyncdispatch-based async benchmark for Prologue. |
| tests/benchmark/b_kairos.nim | Adds a (named) Kairos benchmark using Prologue app setup. |
| tests/benchmark/b_kairos_async.nim | Adds a chronos-based async benchmark variant. |
| src/prologue/websocket/websocket.nim | Switch websocket implementation between Kairos ws and websocketx. |
| src/prologue/openapi/openapi.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/utils.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/staticfilevirtualpath.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/staticfile.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/sessions/signedcookiesession.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/sessions/redissession.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/sessions/memorysession.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/csrf.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/cors.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/clickjacking.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/middlewares/auth.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/core/middlewaresbase.nim | Import asyncbackend instead of asyncdispatch. |
| src/prologue/core/context.nim | Add backend-conditioned asyncfile import and relax raises for Kairos mode. |
| src/prologue/core/beast/server.nim | Add Kairos/httpx settings switch; adjust serving implementation. |
| src/prologue/core/beast/request.nim | Switch NativeRequest type between Kairos and httpx; small API tweak. |
| src/prologue/core/asyncbackend.nim | New module implementing backend selection and re-exports. |
| src/prologue/core/async/sync.nim | Replace direct asyncdispatch import with asyncbackend. |
| src/prologue/core/application.nim | Re-export asyncbackend and adjust logging calls/async run setup. |
| README.md | Document enabling chronos via the Kairos feature/define. |
| prologue.nimble | Add optional kairos feature dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 28 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Excellent work! |
fixes #247
This PR adds support to
chronosvia Kairos (https://github.com/jmgomez/kairos). User can toggle it by usingnimble featuresorasyncBackendnim convention