-
Notifications
You must be signed in to change notification settings - Fork 298
Feature: finish implementation for StateMachineConfig #805
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: feature/saga
Are you sure you want to change the base?
Feature: finish implementation for StateMachineConfig #805
Conversation
pkg/saga/statemachine/engine/core/default_statemachine_config.go
Outdated
Show resolved
Hide resolved
pkg/saga/statemachine/engine/core/default_statemachine_config_test.go
Outdated
Show resolved
Hide resolved
pkg/saga/statemachine/engine/core/default_statemachine_config.go
Outdated
Show resolved
Hide resolved
pkg/saga/statemachine/engine/core/default_statemachine_config.go
Outdated
Show resolved
Hide resolved
) | ||
|
||
type JsonParser interface { |
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.
Why must we use a structure to parse JSON here?
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.
Parameters need to be serialized and deserialized, so a parser was introduced. Method invocation is decoupled from its concrete implementation by defining an interface and a struct, ensuring maintainable and extensible code.
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 understand that what’s needed here is just a Parser interface. Based on the abstraction of the parser, there can be different serialization formats, such as JSON, Protobuf, etc. However, since currently only the JSON format is used, this abstraction might not be necessary.
我理解这里需要的是一个Parser的 interface即可。基于parser的抽象,有不同的序列化方式,比如json,pb等。但是目前只有json的格式,所以这个抽象也许用不到
func NewDefaultStateMachineConfig() *DefaultStateMachineConfig { | ||
|
||
// TODO: Initialize the statemachine_repository, following the implementation of the Java version. |
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.
Why can't we initialize this part at present? Is it because statemachine_repository has not been fully implemented yet? What is missing?
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.
Apologies for the oversight. Initially, I was unsure whether this implementation was required. However, after re-reviewing the codebase from the perspective of aligning versions, I realized it is necessary. This was my mistake, and I will correct it immediately. Thank you for your understanding.
Compatibility issues arose after merging the new expression version. I'm working on fixing them now. |
Sorry for the delayed progress – I'm limited by time and capacity at the moment. I'll keep refining and adding to this PR. Thanks for your understanding! |
} | ||
|
||
func (e *ErrorExpression) SetValue(value any, elContext any) { | ||
//错误表达式不设置值 |
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.
Why hasn’t this been implemented here? Why hasn’t this been implemented here?
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.
Because an ErrorExpression represents a parsing failure and has no valid value to store, its SetValue method is intentionally left empty.
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 originally coupled ErrorExpression with DefaultStateMachineConfig, but I’ve now moved it to the expr package and decoupled it.
pkg/saga/statemachine/engine/core/default_statemachine_config.go
Outdated
Show resolved
Hide resolved
) | ||
|
||
type JsonParser interface { |
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 understand that what’s needed here is just a Parser interface. Based on the abstraction of the parser, there can be different serialization formats, such as JSON, Protobuf, etc. However, since currently only the JSON format is used, this abstraction might not be necessary.
我理解这里需要的是一个Parser的 interface即可。基于parser的抽象,有不同的序列化方式,比如json,pb等。但是目前只有json的格式,所以这个抽象也许用不到
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.
LGTM
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.
LGTM
What this PR does:
Which issue(s) this PR fixes:
Fixes #792
Special notes for your reviewer: The implementation references the Java version but uses Go idioms without Spring dependencies.
Does this PR introduce a user-facing change?: