But Does It Work?

Learn how the Duper application works.

Use the Duper application

Let’s see where we are. We’ve implemented four GenServer and two supervisors. When the application starts, it’ll start the top-level supervisor, which in turn starts Results, PathFinder, WorkerSupervisor, and Gatherer.

When Gatherer starts (and it’ll start last), it tells the WorkerSupervisor to start a number of workers. When each worker starts, it gets a path to process from PathFinder, hashes the corresponding file, and passes the result to Gatherer, which stores the path and the hash in the Results server. When there are no more files to process, each worker sends a :done message to the Gatherer. When the last worker is done, the Gatherer reports the Results.

Everything seems to be ready. Let’s try it:

$ mix run
Compiling 7 files (.ex) 
Generated duper app

Get hands-on with 1400+ tech skills courses.