Module scout::supervisor[][src]

Setup and run the all the tasks that compose the program

The program runs over four main tasks

  • data_input::task: Handles input lines from STDIN
  • person_input::task: Handles the person’s interactions with the program
  • engine::task: The search engine, it performs the actual fuzzy search
  • screen::task: How to print the program’s interface

All tasks are futures that communicate between them sending events through channels as you can see in the following diagram:

+--------------+                    +--------+
| person_input +---------+--------->+ screen |
+------+-------+         ^          +--------+
       |                 |
       v             +---+----+
       +------------>+ engine |
       ^             +--------+
       |
+------+-----+
| data_input |
+------------+

The input from the person using the program is delivered to both the engine and the screen in two different channels. There are some interactions (like moving through the list) that are only relevant to the screen. Others, like new queries, are relevant for both. Using these two channels also makes the screen more responsive to interactions since it doesn’t have to wait for the engine to finish searching in order to update the prompt, for example.

Functions

run

Run the program’s tasks.