Skip to content

Conversation

gjcairo
Copy link
Collaborator

@gjcairo gjcairo commented Oct 6, 2024

Motivation

We want to be able to flatten RPCErrors, and to do so we need to be able to merge the Metadata contained in each.

Modifications

This PR adds a helper function to merge one Metadata instance into another.

Result

Unblocks #2083 and also provides a potentially useful API for users.

- Note: Because of the way Metadata has been implemented, we can have multiple identical key-value pairs. This isn't ideal, as it's particularly feasible that we'll end up with multiple repeated identical pairs when merging two Metadatas. I think we should reconsider the backing data structure (using a set for example) or add a check before inserting to avoid this.

@gjcairo gjcairo requested a review from glbrntt October 7, 2024 09:29
Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

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

Awesome, thanks Gus

@glbrntt glbrntt merged commit d5e0d70 into grpc:main Oct 7, 2024
5 of 8 checks passed
@gjcairo gjcairo deleted the merge-metadata branch October 8, 2024 10:18
@rnro rnro mentioned this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API. version/v2 Relates to v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants