-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
The behavior of this method is implementation defined. For event sourced persistence, it persists any recorded events and DELETES any existing snapshots. For CRUD persistence, it completely deletes the instance.
…pletion check onto the saga state itself.
…duce the likelihood of conflicts with domain code.
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
==========================================
- Coverage 30.24% 29.28% -0.96%
==========================================
Files 65 65
Lines 2169 2240 +71
==========================================
Hits 656 656
- Misses 1503 1574 +71
Partials 10 10
Continue to review full report at Codecov.
|
src/ax/saga/behavior.go
Outdated
@@ -24,3 +24,18 @@ type ErrorIfNotFound struct{} | |||
func (ErrorIfNotFound) HandleNotFound(_ context.Context, _ ax.Sender, _ ax.Envelope) error { | |||
return errors.New("could not find a saga instance to handle message") | |||
} | |||
|
|||
// CompletableByData is an embeddable struct implements a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might need a "that" inserted? Something like "struct that implements" ?
embeddable struct implements a
src/ax/saga/behavior.go
Outdated
type CompletableByData struct{} | ||
|
||
// IsComplete returns true if i.Data implements CompletableData and | ||
// i.Data.IsComplete() returns true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be i.Data.IsInstanceComplete()
?
// DeleteSagaSnapshots deletes any snapshots associated with a saga instance. | ||
// | ||
// The implementation may return an error if snapshots for this instance | ||
// already exists, but belong to a different saga, as identified by pk, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An error if the snapshots for this instance already exist? Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is trying to delete them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's correct, but maybe taking a way the word "already" would be good:
// It returns an error if the instance exists but belongs to a
// different saga, as identified by pk, the saga's persistence key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even just "if the instance belongs to a different saga"
Also improved some documentation around the verification of persistence keys.
Fixes #16
Saga's can now be "completable". When an instance is completed, the saga persistence and mapping systems have an opportunity to remove persisted data. The exact behaviour is implementation depending, with the following behaviour implemented currently:
When a saga instance is completed, the: