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

Implement router.GetNClients #212

Merged
merged 5 commits into from
Jul 27, 2017
Merged

Conversation

andrewdeandrade
Copy link
Contributor

This pull request implements GetNClients in the ringpop router. This is just the router equivalent of the hashring.LookupN function.

@yulunli
Copy link
Contributor

yulunli commented Jul 26, 2017

LGTM

router/router.go Outdated
if err != nil {
return nil, err
}
clients = append(clients, ClientResult{client, isRemote})
Copy link
Contributor

Choose a reason for hiding this comment

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

nit; depending on how often this code is called you might want to consider allocating a slice with the capacity of len(dests) before the loop to prevent excessive allocations in the hot path.

return clients, nil
}

func (r *router) getClientByHost(dest string) (client interface{}, isRemote bool, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! 👍

@andrewdeandrade andrewdeandrade merged commit 3ae147a into master Jul 27, 2017
@andrewdeandrade andrewdeandrade deleted the aandrade.router-getnclients branch July 27, 2017 19:48
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.

3 participants