-
Notifications
You must be signed in to change notification settings - Fork 29
Some refactors regarding Logs & context.Context
#7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hello! |
| You can read more details about this pattern here https://microservices.io/patterns/data/saga.html#example-choreography-based-saga | ||
|
|
||
| # Installing | ||
| ```go get github.com/itimofeev/go-saga``` |
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.
I think that we should keep previous import in order to merge this MR. It'll be strange, if repository will be itimofeev, but module name will contain another name.
| Name string | ||
| Type string | ||
| Time time.Time | ||
| ExecutionID string `gorm:"index;type:varchar(255)"` |
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.
I have some doubts for keeping gorm tags in general Log struct, because not all users use gorm for storing logs.
What do you think if move them to gorm package and convert general Log struct to gorm one somewhere in gorm related code?
| logStore Store | ||
| } | ||
|
|
||
| func NewCoordinator(ctx context.Context, saga *Saga, logStore Store, executionID ...string) *ExecutionCoordinator { |
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.
While I like the idea to have ctx in methods that work with store I'm not sure that removing one of context is the good idea. First context was used to process direct flow when everything happens as expected. But what if user cancels the request, in that case we need to rollback some steps but we can't use the same already canceled context, because we will not be able to commit any rollback transactions.
Could you please clarify how your solution will work in that case?
This PR aims to refactor some points showcased following: