numinnex commented on code in PR #2887:
URL: https://github.com/apache/iggy/pull/2887#discussion_r2904675267
##########
core/common/src/types/consensus/header.rs:
##########
@@ -124,6 +153,40 @@ pub enum Operation {
Reserved = 200,
}
+impl TryFrom<u8> for Operation {
+ type Error = u8;
+
+ fn try_from(value: u8) -> Result<Self, Self::Error> {
+ match value {
+ 0 => Ok(Operation::Default),
+ 128 => Ok(Operation::CreateStream),
+ 129 => Ok(Operation::UpdateStream),
+ 130 => Ok(Operation::DeleteStream),
+ 131 => Ok(Operation::PurgeStream),
+ 132 => Ok(Operation::CreateTopic),
+ 133 => Ok(Operation::UpdateTopic),
+ 134 => Ok(Operation::DeleteTopic),
+ 135 => Ok(Operation::PurgeTopic),
+ 136 => Ok(Operation::CreatePartitions),
+ 137 => Ok(Operation::DeletePartitions),
+ 138 => Ok(Operation::DeleteSegments),
+ 139 => Ok(Operation::CreateConsumerGroup),
+ 140 => Ok(Operation::DeleteConsumerGroup),
+ 141 => Ok(Operation::CreateUser),
+ 142 => Ok(Operation::UpdateUser),
+ 143 => Ok(Operation::DeleteUser),
+ 144 => Ok(Operation::ChangePassword),
+ 145 => Ok(Operation::UpdatePermissions),
+ 146 => Ok(Operation::CreatePersonalAccessToken),
+ 147 => Ok(Operation::DeletePersonalAccessToken),
+ 160 => Ok(Operation::SendMessages),
+ 161 => Ok(Operation::StoreConsumerOffset),
+ 200 => Ok(Operation::Reserved),
Review Comment:
I see, that `Default` is used by the `fn operation(&self) -> Operation` as
default implementation, I think we should return reserved in that case as
that's what it's purpose is.
--
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]