numinnex commented on code in PR #2887:
URL: https://github.com/apache/iggy/pull/2887#discussion_r2904544970
##########
core/common/src/types/consensus/header.rs:
##########
@@ -449,19 +517,21 @@ impl ConsensusHeader for PrepareOkHeader {
const COMMAND: Command2 = Command2::PrepareOk;
fn operation(&self) -> Operation {
- self.operation
+ Operation::try_from(self.operation).expect("validate() must be called
first")
}
fn command(&self) -> Command2 {
Review Comment:
Same for command
##########
core/common/src/types/consensus/header.rs:
##########
@@ -449,19 +517,21 @@ impl ConsensusHeader for PrepareOkHeader {
const COMMAND: Command2 = Command2::PrepareOk;
fn operation(&self) -> Operation {
Review Comment:
In the solution that I've provided we wouoldn't need to use the `TryFrom`,
as we would store the enums directly there, but rather the transistion/creation
part is where validation would happen.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]