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

Add iterator access for entries #645

Merged

Conversation

argerus
Copy link
Contributor

@argerus argerus commented Sep 4, 2023

A wrapper function that made it easy to iterate through metadata was already available in the broker interface:

broker
    .map_metadata(|metadata| proto::Metadata::from(metadata))
    .await

This has been generalized to iterate over entries instead (i.e. not only metadata) as that will be useful when in the kuksa.val.v1 interface for example:

broker
    .map_entries(|entry| {
        // Extract stuff from all entries (including metadata)
    }).await

broker
    .filter_map_entries(|entry| {
        // Extract stuff from some entries (including metadata)
    }).await

@argerus argerus requested a review from lukasmittag September 6, 2023 08:18
Copy link
Contributor

@lukasmittag lukasmittag left a comment

Choose a reason for hiding this comment

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

LGTM just one question. Will filter_map_entries get used cause currently I see not how it gets used. And just to confirm the adaptions get only used in grpc/sdv_databroker_v1 because in the grpc/kuksa_val_v1 the feature is not implemented yet - am I right?

@argerus
Copy link
Contributor Author

argerus commented Sep 6, 2023

LGTM just one question. Will filter_map_entries get used cause currently I see not how it gets used. And just to confirm the adaptions get only used in grpc/sdv_databroker_v1 because in the grpc/kuksa_val_v1 the feature is not implemented yet - am I right?

Correct (on both counts). The reason for adding it (filter_map_entries etc) is that it would have made #641 and similar functionality easier to implement. That PR is already merged, and added very interface specific code to broker.rs. That code can be moved out to live along the rest of the interface specific code when this PR is merged.

@argerus argerus merged commit fed6a1d into eclipse-archived:master Sep 6, 2023
@erikbosch erikbosch deleted the feature/databroker_iter_entries branch October 31, 2024 12:56
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants