Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Crystal::EventLoop namespace #15226

Conversation

ysbaddaden
Copy link
Contributor

@ysbaddaden ysbaddaden commented Nov 25, 2024

The event loop implementations are scattered a bit everywhere, or buried inside src/crystal/system/os when they don't use the Crystal::System namespace at all.

This patch groups all the implementations under Crystal::EventLoop in src/crystal/event_loop. Of course the system parts are kept in (or moved to) Crystal::System.

  • Crystal::Evented::EventLoop => Crystal::EventLoop::Polling (abstract)
  • Crystal::Epoll::EventLoop => Crystal::EventLoop::Epoll
  • Crystal::Kqueue::EventLoop => Crystal::EventLoop::Kqueue
  • Crystal::LibEvent::EventLoop => Crystal::EventLoop::LibEvent
  • Crystal::IOCP::EventLoop => Crystal::EventLoop::IOCP
  • Crystal::IOCP => Crystal::System::IOCP

A new evloop, for example io_uring, would naturally be implemented as Crystal::EventLoop::IoUring.

Builds on top of #15206. See commit 5cd85da.

@ysbaddaden ysbaddaden self-assigned this Nov 25, 2024
@ysbaddaden ysbaddaden changed the title Crystal::EventLoop namespace [fixup #14996] Crystal::EventLoop namespace Nov 25, 2024
@ysbaddaden
Copy link
Contributor Author

I hope nobody has a branch with lots of changes for an event loop 😅

The current event loops are scattered a bit everywhere, or buried inside
`src/crystal/system/x` when they don't use the `Crystal::System`
namespace. This patch groups all the implementations under
`Crystal::EventLoop` in `src/crystal/event_loop`.

Of course the actual system parts are kept in (or moved to)
`Crystal::System`.

- `Crystal::Evented::EventLoop`  => `Crystal::EventLoop::Polling` (abstract)
- `Crystal::Epoll::EventLoop`    => `Crystal::EventLoop::Epoll`
- `Crystal::Kqueue::EventLoop`   => `Crystal::EventLoop::Kqueue`
- `Crystal::LibEvent::EventLoop` => `Crystal::EventLoop::LibEvent`
- `Crystal::IOCP::EventLoop`     => `Crystal::EventLoop::IOCP`
- `Crystal::IOCP`                => `Crystal::System::IOCP`

A new evloop, for example `io_uring`, would naturally be implemented as
`Crystal::EventLoop::IoUring`.
@ysbaddaden ysbaddaden force-pushed the feature/crystal-event-loop-namespace branch from 1032790 to c5bba26 Compare November 28, 2024 10:47
@ysbaddaden ysbaddaden marked this pull request as ready for review November 28, 2024 10:47
@straight-shoota straight-shoota added this to the 1.15.0 milestone Nov 28, 2024
@straight-shoota straight-shoota merged commit 8e339d1 into crystal-lang:master Dec 1, 2024
69 checks passed
@ysbaddaden ysbaddaden deleted the feature/crystal-event-loop-namespace branch December 2, 2024 12:23
@straight-shoota straight-shoota changed the title Crystal::EventLoop namespace Introduce Crystal::EventLoop namespace Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants