Skip to content
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

feat: Talos messenger base #83

Merged
merged 10 commits into from
Sep 26, 2023
Merged

feat: Talos messenger base #83

merged 10 commits into from
Sep 26, 2023

Conversation

gk-kindred
Copy link
Collaborator

Future PRs would implement:-

  • Pruning of suffix
  • Committing offsets to Kafka
  • More unit tests - especially around suffix used in messenger

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Attention: 138 lines in your changes are missing coverage. Please review.

Comparison is base (d99010a) 57.95% compared to head (dfe989c) 57.28%.

❗ Current head dfe989c differs from pull request most recent head 48092e1. Consider uploading reports for the commit 48092e1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #83      +/-   ##
==========================================
- Coverage   57.95%   57.28%   -0.68%     
==========================================
  Files         103      114      +11     
  Lines        5333     5570     +237     
==========================================
+ Hits         3091     3191     +100     
- Misses       2242     2379     +137     
Files Coverage Δ
examples/messenger_using_kafka/src/lib.rs 100.00% <100.00%> (ø)
...ges/talos_certifier/src/model/candidate_message.rs 100.00% <100.00%> (ø)
packages/talos_messenger_actions/src/lib.rs 100.00% <100.00%> (ø)
packages/talos_messenger_core/src/lib.rs 100.00% <100.00%> (ø)
packages/talos_messenger_core/src/utlis.rs 100.00% <100.00%> (ø)
packages/talos_suffix/src/core.rs 100.00% <ø> (ø)
packages/talos_suffix/src/suffix.rs 90.83% <66.66%> (ø)
...alos_messenger_core/src/talos_messenger_service.rs 0.00% <0.00%> (ø)
...ages/talos_certifier/src/model/decision_message.rs 54.34% <0.00%> (-3.80%) ⬇️
packages/talos_messenger_core/src/tests/utils.rs 96.05% <96.05%> (ø)
... and 5 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}

async fn send(&self, version: u64, payload: Self::Payload, additional_data: Self::AdditionalData) -> () {
info!("[MessengerKafkaPublisher] Publishing message with payload=\n{payload:#?}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good if we could agree on prefix, so that we use it consistently. Somewhere in the code I used format like this: "MessengerKafkaPublisher.send(): ...". Does not matter really just better when there is one format :)

)));
}
Err(err) => {
// TODO: GK - what to do on error? Panic?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we panic and do not commit offset then pods will keep restarting and will be stuck in that consume/panic/restart loop.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failure to commit, while undesirable, shouldn't violate safety.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The todo is for the channel. What to do if the channel gives an error. As this is the way I get to know some Kafka action has been processed, and then mark it in suffix.

Realistically the channel would give error when we try to send the message after the receiver was closed, so can I make the assumption that we can ignore the error check for channel.send ?

}

#[derive(Debug, Display, Serialize, Deserialize, EnumString, Clone, Eq, PartialEq)]
pub enum PublishActionType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we rename this to represent a list of brokers? If I read the intention correctly this enum wants to list what messaging brokers we can publish to. In that case its no so much of a "...ActionType" anymore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually can I leave this comment for the next PR please? Some part of it actually would get more generic. Like line 10 - CommitActionType is not used anymore. And my idea around the implementation has become bit more generic since the time these enums where created.

}

pub enum MessengerChannelFeedback {
Error(u64, String),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to make simple structs or named variables. Tuple style allows only to show types but names and purposes are very not clear :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, just the lazy me to blame :) I will update this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this one while updating the review comments changes. Will update it in the next PR

todo!()
}

// TODO: GK - Elevate this to core suffix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

Copy link
Contributor

@fmarek-kindred fmarek-kindred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments. Can merge to reduce the number of pending PRs, but will need to finish bits a pieces in TODOs

@gk-kindred gk-kindred merged commit 4c58df0 into master Sep 26, 2023
2 checks passed
@gk-kindred gk-kindred deleted the feature/talos-messenger branch September 26, 2023 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants