egeberkaygulcan / dstest

2 stars 1 forks source link

✨ Bootstrap faults #13

Closed joaomlneto closed 2 months ago

joaomlneto commented 2 months ago

Discussion card on Trello


Requesting comments on how to implement the faults. This is a synopsis of what I want to implement.

  1. Fault representation OK?
  2. When/how to inject faults OK?

A Fault is a <Trigger, Behavior> tuple. A Trigger checks whether a given behavior is to be applied. A behavior is something happening outside of the specification of the application.

Some examples of triggers:

Some examples of behaviors:

This should place little to no limits on expressivity and allows for reusability via composition.


When to inject faults, the option that makes most sense to me is the following:

Apply faults when a message is queued (captured by the Interceptor and passed through the Translator).

So, after the translator does its thing, we’d pass the message through the faults. Something like this

tm := r.MessageTranslator.Translate(message)
for _, fault := range faults {
  fault.ApplyIfTriggered(message)
}

Since we’re likely to have a small number of faults, the O(N) should be negligible.

joaomlneto commented 2 months ago

Slight but meaningful changes from the above definition.

Before Faults were being applied automatically. Now, they are either enabled or disabled. The Scheduler can then decide to schedule these instead of messages: Whenever we invoke Scheduler.Next(actions) from the scheduler, we now also pass the set of enabled faults (the faults that have a true precondition): Scheduler.Next(actions, faults).

The set of faults are configured in the config.yml file. See example.

TODO