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

Hasher in client config is unusable #14

Open
skinass opened this issue Sep 23, 2020 · 1 comment
Open

Hasher in client config is unusable #14

skinass opened this issue Sep 23, 2020 · 1 comment

Comments

@skinass
Copy link

skinass commented Sep 23, 2020

type Config struct {
	Hasher     hasher
        ...
type hasher interface {
	update(servers []*server)
	getServerIndex(key string) (uint, error)
}

now Hasher should implement an interface with private methods with private types like *server so the only way to define a Hasher is to use a NewModuloHasher() function.

the problem is that Hasher field is public, but i cant really use it.

i purpose to change the interface this way:

type Hasher interface {
	Update(servers []strings)
	GetServerIndex(key string) (uint, error)
}

this will let us to make custom implemenation of Hasher interface

@saschat
Copy link
Member

saschat commented Sep 23, 2020

Sounds good. PR is welcome.

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

No branches or pull requests

2 participants