Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

[databroker] Update calls to subscribe #692

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions kuksa_databroker/databroker/src/viss/v2/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,18 @@ impl Viss for Server {
})?;
let broker = self.broker.authorized_access(&permissions);

let entries = HashMap::from([(
Into::<String>::into(request.path),
HashSet::from([broker::Field::Datapoint]),
)]);
let Some(entries) = broker
.get_id_by_path(request.path.as_ref())
.await
.map(|id| HashMap::from([(id, HashSet::from([broker::Field::Datapoint]))]))
else {
return Err(SubscribeErrorResponse {
request_id,
error: Error::NotFoundInvalidPath,
ts: SystemTime::now().into(),
});
};

match broker.subscribe(entries).await {
Ok(stream) => {
let subscription_id = SubscriptionId::new();
Expand Down