HackerExperience / Helix

GNU Affero General Public License v3.0
53 stars 10 forks source link

Add method to regenerate story/mission elements based on events #333

Closed renatomassaro closed 6 years ago

renatomassaro commented 6 years ago

Possible interface:

which translates to:

The full signature, which allows for custom logic, is something like:


story_listen cracker.file_id, FileDeletedEvent, :on_file_delete

callback on_file_delete [, event] do
  {:regenerate, []}
end

The end result is the same: the regenerate/2 is called. regenerate must be able to:

Except for the helper handle_file_loss, the listener interface described above is already implemented. Now it's just a matter of figuring out how to create the regenerate/2 method in a maintainable way.

renatomassaro commented 6 years ago

:regenerate and :fail actions have been merged into :restart.

PR #383 solves this in a scalable way, but I've postponed the creation of more specific listeners like handle_file_loss, handle_file_unavailability, handle_log_loss, handle_log_misedit etc.