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
now
Hashershould implement an interface with private methods with private types like*serverso the only way to define aHasheris to use aNewModuloHasher()function.the problem is that
Hasherfield is public, but i cant really use it.i purpose to change the interface this way:
this will let us to make custom implemenation of Hasher interface