sparkles:event-horizon
sparkles:event-horizon is a completion-first event loop for D: io_uring on Linux, kqueue on macOS and the BSDs, IOCP on Windows (in progress), driven in three tiers — a callback loop, direct-style fibers with structured concurrency, and an Effect!T veneer — with process supervision, channels, retry schedules and a bounded pool for the few host calls a completion backend cannot express.
Use it when a program has to wait on many things at once — sockets, files, timers, child processes, signals — and you want that waiting to read as ordinary sequential code, with cancellation, timeouts and cleanup that cannot be forgotten.
import sparkles.event_horizon;
import core.time : msecs;
LoopGroup group;
if (LoopGroup.start(group).hasError)
assert(false, "no completion backend");
scope (exit) group.shutdown();
auto outcome = group.run((ref RootScope sc, ref Env env) {
cast(void) env.clock.sleep(10.msecs); // parks the fiber, not the thread
return 42;
});
assert(outcome.value == 42);How this documentation is organised
These docs follow the Diátaxis framework.
Tutorial
Learning-oriented.
- Coming from Node.js — the event loop you already know, mapped concept by concept onto fibers, scopes, channels and supervised processes, with runnable programs for each.
- Coming from eventcore — proactor drivers, callbacks, and handle ownership mapped to scoped fibers and I/O results.
- Coming from vibe-core — direct-style fibers and task handles mapped to explicit scope ownership and cancellation.
- Coming from libasync — comparing callback I/O, file workers, and cross-thread notifications with scoped I/O.
- Coming from Photon — comparing Photon's syscall interception and fibers with explicit capabilities and scopes.
- Coming from collie — Netty/Finagle-style channel pipelines and readiness loops compared with completion-first fibers, move-only buffers, and structured concurrency.
- Coming from hunt-net — Java/Netty/Vert.x-inspired asynchronous networking, codecs, and connection handlers mapped to stream primitives.
- Coming from EVE — layered backends and runtime facilities mapped to scoped fibers, outcomes, and bounded channels.
- Running the examples — Linux prerequisites, executable shared examples, partial I/O, error handling, and support boundaries.
Reference
Information-oriented. The normative surface lives in the specification for now: SPEC.md (public API in §16) and the delivery status in PLAN.md.
Explanation
Understanding-oriented. The research behind the design: Async I/O & Event Loops and Process Supervision.