Isn't `Saga` the same as `Resource`? Why do we hav...
# arrow
y
Isn't
Saga
the same as
Resource
? Why do we have two separate types for them?
s
The docs here clarify this https://arrow-kt.io/learn/resilience/saga/
Copy code
Saga and Resource
SagaScope has many parallels with ResourceScope: both ensure that some operations are performed at a certain point, and saga and install require an action that "undoes" something. The main difference is that ResourceScope always runs the release actions, whereas SagaScope only runs compensation if the entire action fails.
y
Ohhhh, that makes a lot of sense! Well, I wonder if it can be re-implemented using the
case
versions of
Resource
. Might make a PR!
s
One thing to note is that these two live in different places. One is in coroutines one is in resilience, so it may even be separate modules that don't rely on each other. Guessing a bit here, didn't go in there to check.