Skip to content

[Deprecated] Architecture

Vojta Smrcek edited this page Sep 7, 2018 · 1 revision

General diagram of the FluxC architecture: Architecture Diagram

The dispatcher is the central piece of communication between the app, stores and network clients. It acts like an event bus (it's currently just an event bus wrapper).

Notes:

  • WP REST API client is not implemented yet (we have a proof of concept and discovery utils).
  • Memory storage is optional, it makes sense to have some data in memory so we don't have to hit the DB everytime we call a Store's getter. The Account Store is currently the only Store using data stored in memory.

An app based on FluxC communicates via different channels:

  1. App sends actions. Actions are interpreted by one or multiple Stores.
  2. Stores generate events. Some events might be observed by the app.
  3. App gets data from Stores.

Example:

  1. App asks FluxC to FETCH_SITE for site X. The SiteStore is listening for this FETCH_SITE action, will trigger a call to the XMLRPC or REST client depending of site X.
  2. Network client receive a response from the server and notify the SiteStore. The SiteStore updates the site in the DB and generates an OnSiteChanged event. The app is listening for OnSiteChanged events.
  3. App gets updated site by calling the getSiteByLocalId() getter on the SiteStore.