Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

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

Closed
renatomassaro opened this issue Nov 13, 2017 · 1 comment
Closed
Assignees

Comments

@renatomassaro
Copy link
Member

Possible interface:

  • handle_file_loss cracker.file_id

which translates to:

  • Listen to any "file loss" event (FileDeleted, FileEncrypted, FileHidden)
  • Reacts by calling regenerate/2

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:

  • figure out what is inconsistent;
  • fix it (delete everything and recreate; or only recreate what is inconsistent. Depends on the implementation of each step/mission)

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
Copy link
Member Author

: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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant