<commit_before>Synapse Architecture
====================

As of the end of Oct 2014, Synapse's overall architecture looks like::

                                   Notifier
                                     ^  |
                                     |  |
                           .------------|------.
                           | handlers/  |      |
                           |            v      |
                           | Event*Handler<---------> rest/* <=> Client
                           | Rooms*Handler     |
  HSes <=> federation/* <==> FederationHandler |
               |           | PresenceHandler   |
               |           | TypingHandler     |
               |           '-------------------'
               |                 |     |
               |              state/*  |
               |                 |     |
               |                 v     v
               `--------------> storage/*
                                   |
                                   v
                                .----.
                                | DB |
                                '----'

* Handlers: business logic of synapse itself.  Follows a set contract of BaseHandler:

 * BaseHandler gives us onNewRoomEvent which: (TODO: flesh this out and make it less cryptic):
 
   * handle_state(event)
   * auth(event)
   * persist_event(event)
   * notify notifier or federation(event)
   
 * PresenceHandler: use distributor to get EDUs out of Federation.  Very
   lightweight logic built on the distributor
 * TypingHandler: use distributor to get EDUs out of Federation.  Very
   lightweight logic built on the distributor
 * EventsHandler: handles the events stream...
 * FederationHandler: - gets PDU from Federation Layer; turns into an event;
   follows basehandler functionality.
 * RoomsHandler: does all the room logic, including members - lots of classes in
   RoomsHandler.
 * ProfileHandler: talks to the storage to store/retrieve profile info.

* EventFactory: generates events of particular event types.
* Notifier: Backs the events handler
* REST: Interfaces handlers and events to the outside world via HTTP/JSON.
  Converts events back and forth from JSON.<commit_msg>moar boxes.<commit_after>Synapse Architecture
====================

As of the end of Oct 2014, Synapse's overall architecture looks like::

        synapse
        .-----------------------------------------------------.
        |                          Notifier                   |
        |                            ^  |                     |
        |                            |  |                     |
        |                  .------------|------.              |
        |                  | handlers/  |      |              |
        |                  |            v      |              |
        |                  | Event*Handler<---------> rest/* <=> Client
        |                  | Rooms*Handler     |              |
  HSes <=> federation/* <==> FederationHandler |              |
        |      |           | PresenceHandler   |              |
        |      |           | TypingHandler     |              |
        |      |           '-------------------'              |
        |      |                 |     |                      |
        |      |              state/*  |                      |
        |      |                 |     |                      |
        |      |                 v     v                      |
        |      `--------------> storage/*                     |
        |                          |                          |
        '--------------------------|--------------------------'
                                   v
                                .----.
                                | DB |
                                '----'

* Handlers: business logic of synapse itself.  Follows a set contract of BaseHandler:

 * BaseHandler gives us onNewRoomEvent which: (TODO: flesh this out and make it less cryptic):
 
   * handle_state(event)
   * auth(event)
   * persist_event(event)
   * notify notifier or federation(event)
   
 * PresenceHandler: use distributor to get EDUs out of Federation.  Very
   lightweight logic built on the distributor
 * TypingHandler: use distributor to get EDUs out of Federation.  Very
   lightweight logic built on the distributor
 * EventsHandler: handles the events stream...
 * FederationHandler: - gets PDU from Federation Layer; turns into an event;
   follows basehandler functionality.
 * RoomsHandler: does all the room logic, including members - lots of classes in
   RoomsHandler.
 * ProfileHandler: talks to the storage to store/retrieve profile info.

* EventFactory: generates events of particular event types.
* Notifier: Backs the events handler
* REST: Interfaces handlers and events to the outside world via HTTP/JSON.
  Converts events back and forth from JSON.
{'fraction_non_alphanumeric': 0.11910112359550562, 'fraction_numerical': 0.001634320735444331, 'mean_word_length': 0.9615384615384616, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2389792', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1022, 'n_words': 335}