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

optimize endpoints Targets struct #4377

Open
2 tasks done
dongjiang1989 opened this issue Apr 10, 2024 · 1 comment
Open
2 tasks done

optimize endpoints Targets struct #4377

dongjiang1989 opened this issue Apr 10, 2024 · 1 comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@dongjiang1989
Copy link
Contributor

dongjiang1989 commented Apr 10, 2024

What would you like to be added:

 it may call ParseAddr many times for the same target.
So let's give us one more chance to avoid that. I have an other idea.

Wdyt about converting Target from a string to a struct with a string and Addr* ?
It would mean it may use Addr when it's relevant and keep string comparison when it's not an IP ?

Originally posted by @mloiseleur in #4351 (comment)

Why is this needed:

change Targets from []string to []Target

type Target struct {
	Addr netip.Addr
	Raw  string
}
// Targets is a representation of a list of targets for an endpoint.
type Targets []Target

Tasks

  1. approved cncf-cla: yes lgtm ok-to-test size/M
    mloiseleur
  2. cncf-cla: yes needs-ok-to-test size/XXL
@dongjiang1989 dongjiang1989 added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 10, 2024
@dongjiang1989
Copy link
Contributor Author

/cc @mloiseleur
I'll add a follow-up PR to optimize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant