Skip to content

A brief description of internals

Félix Saparelli edited this page Jul 8, 2018 · 5 revisions

Notify really is a box with two public sides: the frontend, with which most people interact, and the backend, which is the purview of implementors. Notify specifies what a backend should do, and what it will be provided. It then manages backends to provide its frontend interface.

Inside the box, there are several components and layers:

  1. Lives directly wrap a single backend, and are what provides the backend interface. They are responsible for hooking up event streams to a backend when it's live, and keeping them ready when it's not. A Life is stateful, a Backend is not, and that is where that difference is managed.

  2. The Manager allocates Lives as supported by the platform, and then commands those lives to watch paths or not. It receives events from any and all Lives, and builds a single stream to be consumed from them all. It also starts and hooks up Middlewares as needed.

  3. Middlewares watch the event stream filtered by the events' Backend's (lack of) capabilities. A Middleware issues commands to the Manager in response, to simulate a particular capability for a Backend that doesn't support it natively.

  4. The Interfaces wrap the Manager again, exposing only what the public API requires and abstracting away some of the details, for example the startup sequence. There's currently two Interfaces: the default Future-based API, and the Future-less API which hides the Future-ful reality behind a more classic channel-and-thread approach.

Clone this wiki locally