The Duper Application
We’ll start by creating a supervised application:
| $ mix new --sup duper |
| $ cd duper |
| $ git init |
| $ git add . |
| $ git commit -a -m 'raw application' |
Time to start writing servers.
The Results Server
The results server wraps an Elixir map. When it starts, it sets its state to an empty map. The keys of this map are hash values, and the values are the list of one of more paths whose files have that hash.
The server provides two API calls: one to add a hash/path pair to the map, the second to retrieve entries that have more than one path in the value (as these are two duplicate files).
This is similar to the code we wrote for the sequence stash:
Get Programming Elixir ≥ 1.6 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.