Skip to content

Commit

Permalink
fix(downloader): multiservice discovery should filter boundary nodes …
Browse files Browse the repository at this point in the history
…based on target name (#219)

* fixing downloader

* removing extra println
  • Loading branch information
NikolaMilosa committed Feb 28, 2024
1 parent 0411fd7 commit 5251ab9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pub mod target;
pub trait DataContract {
fn get_name(&self) -> String;
fn get_id(&self) -> String;
fn get_target_name(&self) -> String;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ impl DataContract for Sns {
fn get_id(&self) -> String {
self.root_canister_id.to_string()
}

fn get_target_name(&self) -> String {
self.name.to_string()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ impl DataContract for TargetDto {
fn get_id(&self) -> String {
self.node_id.to_string()
}

fn get_target_name(&self) -> String {
self.name.to_string()
}
}

pub fn map_to_target_dto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl NodeIDRegexFilter {
impl TargetGroupFilter for NodeIDRegexFilter {
fn filter(&self, target_group: &dyn DataContract) -> bool {
if target_group.get_id() == self.bn_principal_placeholder.to_string() {
return self.regex.is_match(&target_group.get_name().to_string());
return self.regex.is_match(&target_group.get_target_name().to_string());
}

self.regex.is_match(&target_group.get_id())
Expand Down

0 comments on commit 5251ab9

Please sign in to comment.