-
Notifications
You must be signed in to change notification settings - Fork 0
added definition source and mapping on send #146
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
18fbc4d
feat: added definition source and mapping on send
raphael-goetz 4e6d8c4
ref: fixed typo
raphael-goetz 478f7cd
Update src/flow_service/mod.rs
raphael-goetz 1315652
Update src/flow_service/mod.rs
raphael-goetz de3b9c1
Update src/flow_service/mod.rs
raphael-goetz 37893da
Update src/flow_service/mod.rs
raphael-goetz 4ccb083
Update src/flow_service/mod.rs
raphael-goetz 4450d42
Update src/flow_service/mod.rs
raphael-goetz 3231fcc
Update src/flow_service/mod.rs
raphael-goetz 5d433c3
fix: correct type assignment
raphael-goetz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,7 @@ pub struct FlowUpdateService { | |||||
| flow_types: Vec<FlowType>, | ||||||
| channel: Channel, | ||||||
| aquila_token: String, | ||||||
| definition_source: Option<String>, | ||||||
| } | ||||||
|
|
||||||
| impl FlowUpdateService { | ||||||
|
|
@@ -64,9 +65,15 @@ impl FlowUpdateService { | |||||
| flow_types, | ||||||
| channel, | ||||||
| aquila_token, | ||||||
| definition_source: None, | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| pub fn with_definition_source(mut self, source: String) -> Self { | ||||||
| self.definition_source = Some(source); | ||||||
| self | ||||||
| } | ||||||
|
|
||||||
| pub fn with_flow_types(mut self, flow_types: Vec<FlowType>) -> Self { | ||||||
| self.flow_types = flow_types; | ||||||
| self | ||||||
|
|
@@ -90,24 +97,30 @@ impl FlowUpdateService { | |||||
| self | ||||||
| } | ||||||
|
|
||||||
| pub async fn send(&self) { | ||||||
| pub async fn send(&mut self) { | ||||||
| let _ = self.send_with_status().await; | ||||||
| } | ||||||
|
|
||||||
| pub async fn send_with_status(&self) -> bool { | ||||||
| pub async fn send_with_status(&mut self) -> bool { | ||||||
| let data_types_success = self.update_data_types().await; | ||||||
| let runtime_functions_success = self.update_runtime_functions().await; | ||||||
| let functions_success = self.update_functions().await; | ||||||
| let flow_types_success = self.update_flow_types().await; | ||||||
| data_types_success && runtime_functions_success && functions_success && flow_types_success | ||||||
| } | ||||||
|
|
||||||
| async fn update_data_types(&self) -> bool { | ||||||
| async fn update_data_types(&mut self) -> bool { | ||||||
| if self.data_types.is_empty() { | ||||||
| log::info!("No DataTypes present."); | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| if let Some(source) = &self.definition_source { | ||||||
| for data_type in self.data_types.iter_mut() { | ||||||
| data_type.definition_source = source.to_string(); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| log::info!("Updating {} DataTypes.", self.data_types.len()); | ||||||
| let mut client = DataTypeServiceClient::new(self.channel.clone()); | ||||||
| let request = Request::from_parts( | ||||||
|
|
@@ -135,12 +148,18 @@ impl FlowUpdateService { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| async fn update_functions(&self) -> bool { | ||||||
| async fn update_functions(&mut self) -> bool { | ||||||
| if self.functions.is_empty() { | ||||||
| log::info!("No FunctionDefinitions present."); | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| if let Some(source) = &self.definition_source { | ||||||
| for function in self.functions.iter_mut() { | ||||||
| function.definition_source = source.to_string(); | ||||||
| } | ||||||
| }; | ||||||
|
raphael-goetz marked this conversation as resolved.
|
||||||
| }; | |
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.