Skip to content

Commit

Permalink
Minor Renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
wba2hi committed Oct 1, 2024
1 parent 36ee7e0 commit 649c4e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions databroker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ impl<'a, 'b> AuthorizedAccess<'a, 'b> {
.iter()
.flat_map(|subscription| subscription.vss_ids.clone())
.collect();
let intersection: Vec<_> = vss_ids
let intersection: Vec<&i32> = vss_ids
.iter()
.filter(|&x| provided_vss_ids.contains(x))
.collect();
Expand Down Expand Up @@ -1706,17 +1706,18 @@ impl<'a, 'b> AuthorizedAccess<'a, 'b> {
&self,
actuation_changes: Vec<ActuationChange>,
) -> HashMap<i32, Vec<ActuationChange>> {
let mut actuation_changes_per_vss_id: HashMap<i32, Vec<ActuationChange>> = HashMap::new();
for ele in actuation_changes {
let vss_id = ele.id;
let mut actuation_changes_per_vss_id: HashMap<i32, Vec<ActuationChange>> =
HashMap::with_capacity(actuation_changes.len());
for actuation_change in actuation_changes {
let vss_id = actuation_change.id;

let opt_vss_ids = actuation_changes_per_vss_id.get_mut(&vss_id);
match opt_vss_ids {
Some(vss_ids) => {
vss_ids.push(ele.clone());
vss_ids.push(actuation_change.clone());
}
None => {
let vec = vec![ele.clone()];
let vec = vec![actuation_change.clone()];
actuation_changes_per_vss_id.insert(vss_id, vec);
}
}
Expand All @@ -1738,6 +1739,7 @@ impl<'a, 'b> AuthorizedAccess<'a, 'b> {
for actuation_change in &actuation_changes {
let vss_id = actuation_change.id;
let result_entry = self.get_entry_by_id(vss_id).await;

match result_entry {
Ok(entry) => {
let vss_path = entry.metadata.path;
Expand All @@ -1750,10 +1752,8 @@ impl<'a, 'b> AuthorizedAccess<'a, 'b> {
return Err((ActuationError::PermissionDenied, message));
}
Err(PermissionError::Expired) => {
return Err((
ActuationError::PermissionExpired,
"Permission expired".to_string(),
))
let message = "Permission expired".to_string();
return Err((ActuationError::PermissionExpired, message));
}
}
}
Expand Down Expand Up @@ -1807,9 +1807,9 @@ impl<'a, 'b> AuthorizedAccess<'a, 'b> {
let actuation_changes_per_vss_id = &self
.map_actuation_changes_by_vss_id(actuation_changes)
.await;
for ele in actuation_changes_per_vss_id {
let vss_id = *ele.0;
let actuation_changes = ele.1.clone();
for actuation_change_per_vss_id in actuation_changes_per_vss_id {
let vss_id = *actuation_change_per_vss_id.0;
let actuation_changes = actuation_change_per_vss_id.1.clone();

let opt_actuation_subscription = actuation_subscriptions
.iter()
Expand Down
6 changes: 3 additions & 3 deletions databroker/src/grpc/kuksa_val_v2/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ impl proto::val_server::Val for broker::DataBroker {
let actuate_requests = request.into_inner().actuate_requests;

let mut actuation_changes: Vec<ActuationChange> = vec![];
for ele in actuate_requests {
let vss_id = match ele.signal_id {
for actuate_request in actuate_requests {
let vss_id = match actuate_request.signal_id {
Some(signal_id) => match signal_id.signal {
Some(proto::signal_id::Signal::Id(vss_id)) => vss_id,
Some(proto::signal_id::Signal::Path(vss_path)) => {
Expand All @@ -307,7 +307,7 @@ impl proto::val_server::Val for broker::DataBroker {
},
None => return Err(tonic::Status::invalid_argument("Signal_Id not provided")),
};
let data_value = match ele.value {
let data_value = match actuate_request.value {
Some(data_value) => DataValue::from(data_value),
None => return Err(tonic::Status::invalid_argument("")),
};
Expand Down

0 comments on commit 649c4e0

Please sign in to comment.