diff --git a/examples/client/dc_filter/dc_filter.go b/examples/client/dc_filter/dc_filter.go index 49d52a0e..9b018281 100644 --- a/examples/client/dc_filter/dc_filter.go +++ b/examples/client/dc_filter/dc_filter.go @@ -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"]) diff --git a/selector/options.go b/selector/options.go index 13973489..a9fe796d 100644 --- a/selector/options.go +++ b/selector/options.go @@ -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) } diff --git a/selector/selector.go b/selector/selector.go index 551b0a41..42ccd300 100644 --- a/selector/selector.go +++ b/selector/selector.go @@ -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()