Skip to content

Introduce Crystal::EventLoop namespace#15226

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:feature/crystal-event-loop-namespace
Dec 1, 2024
Merged

Introduce Crystal::EventLoop namespace#15226
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:feature/crystal-event-loop-namespace

Conversation

@ysbaddaden
Copy link
Collaborator

@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
Collaborator 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
@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