Change SelectFilter to Filter

This commit is contained in:
Asim 2016-04-23 20:15:01 +01:00
parent a4c05fd6ad
commit 4d4f842702
3 changed files with 6 additions and 6 deletions

View File

@ -41,7 +41,7 @@ func (dc *dcWrapper) Call(ctx context.Context, req client.Request, rsp interface
}
callOptions := append(opts, client.WithSelectOption(
selector.Filter(filter),
selector.WithFilter(filter),
))
fmt.Printf("[DC Wrapper] filtering for datacenter %s\n", md["datacenter"])

View File

@ -15,7 +15,7 @@ type Options struct {
}
type SelectOptions struct {
Filters []SelectFilter
Filters []Filter
// Other options for implementations of the interface
// can be stored in a context
@ -35,9 +35,9 @@ func Registry(r registry.Registry) Option {
}
}
// Filter adds a filter function to the list of filters
// WithFilter adds a filter function to the list of filters
// used during the Select call.
func Filter(fn SelectFilter) SelectOption {
func WithFilter(fn Filter) SelectOption {
return func(o *SelectOptions) {
o.Filters = append(o.Filters, fn)
}

View File

@ -82,8 +82,8 @@ type Selector interface {
// based on the selector's algorithm
type Next func() (*registry.Node, error)
// SelectFilter is used to filter a service during the selection process
type SelectFilter func([]*registry.Service) []*registry.Service
// Filter is used to filter a service during the selection process
type Filter func([]*registry.Service) []*registry.Service
var (
DefaultSelector = newRandomSelector()