Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore legacy hashing behavior #26

Merged
merged 4 commits into from
Jun 26, 2024
Merged

Conversation

tjons
Copy link
Contributor

@tjons tjons commented Jun 26, 2024

The .Hash() method is used in our envoyfilter and route names in Gloo Mesh. Changing the default behavior of this method would lead to those resources being regenerated due to the name change, which we want to avoid.

This PR refactors the work done in #25 and #24 to be contained in a .HashUnique() method, and preserves the original .Hash() method, marking it as deprecated.

Copy link

@SirNexus SirNexus left a comment

Choose a reason for hiding this comment

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

Nice tests. LGTM

//
// Deprecated: due to hashing implemention only using field values. The omission
// of the field name in the hash calculation can lead to hash collisions.
// Prefer the HashUnique function instead.
func (m {{ (msgTyp .).Pointer }}) Hash(hasher hash.Hash64) (uint64, error) {

Choose a reason for hiding this comment

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

Does this comment lead to IDE's knowing the function is deprecated? I suppose what I'm asking is, is the comment here preserved?

@tjons tjons merged commit 08ea32b into master Jun 26, 2024
1 check passed
@marcogschmidt marcogschmidt deleted the tjons/restore-legacy-hashing branch June 26, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants