flare_mlake · API

flare.runtime

flare.runtime — event-loop primitives for the Stage 1 reactor.

Public exports, by area:

  • Reactor: Reactor, Event, INTEREST_READ, INTEREST_WRITE, EVENT_READABLE, EVENT_WRITABLE, EVENT_ERROR, EVENT_HUP, WAKEUP_TOKEN, LISTENER_TOKEN.
  • Scheduling: Scheduler, Frontend, TimerWheel, num_cpus, default_worker_count, block_in_pool.
  • Buffers and memory: Pool, BufferPool, BufferHandle, IoVecBuf, writev_buf.
  • Cross-worker handoff: HandoffQueue, WorkerHandoffPool, HandoffPolicy.
  • Misc: DateCache, the io_uring block, and the time helpers.

Read the module source for the authoritative list; names here that are not re-exported from this barrel carry no stability guarantee.

Reactor wraps epoll (Linux) and kqueue (macOS) behind a uniform API. Use it to build single-threaded servers that handle many concurrent connections from one OS thread. See the module docstring on Reactor for an end-to-end example.

For multicore servers, use HttpServer.serve(handler, num_workers=N) with N >= 2 and size N with num_cpus() (total logical CPUs) or default_worker_count() (sensible default for IO-bound handlers).