<commit_before>package discovery

import (
	"github.com/gkarlik/quark-go/service"
	lb "github.com/gkarlik/quark-go/service/loadbalancer"
)

// Option represents function which is used to apply service discovery options.
type Option func(*Options)

// Options represents service discovery options.
type Options struct {
	Info     service.Info             // service info
	Strategy lb.LoadBalancingStrategy // load balancing strategy
}

// ByInfo allows to discover service by its info metadata.
func ByInfo(i service.Info) Option {
	return func(opts *Options) {
		opts.Info = i
	}
}

// WithInfo allows to register service by its info metadata.
func WithInfo(i service.Info) Option {
	return ByInfo(i)
}

// ByName allows to discover service by its name.
func ByName(name string) Option {
	return func(opts *Options) {
		opts.Info.Name = name
	}
}

// ByTag allows to discover service by its tag(s).
func ByTag(tag string) Option {
	return func(opts *Options) {
		opts.Info.Tags = []string{tag}
	}
}

// UsingLBStrategy allows to discover service using specified load balancing strategy.
func UsingLBStrategy(s lb.LoadBalancingStrategy) Option {
	return func(opts *Options) {
		opts.Strategy = s
	}
}<commit_msg>Discovery options: fix + extension.<commit_after>package discovery

import (
	"github.com/gkarlik/quark-go/service"
	lb "github.com/gkarlik/quark-go/service/loadbalancer"
)

// Option represents function which is used to apply service discovery options.
type Option func(*Options)

// Options represents service discovery options.
type Options struct {
	Info     service.Info             // service info
	Strategy lb.LoadBalancingStrategy // load balancing strategy
}

// ByInfo allows to discover service by its info metadata.
func ByInfo(i service.Info) Option {
	return func(opts *Options) {
		opts.Info = i
	}
}

// WithInfo allows to register service by its info metadata.
func WithInfo(i service.Info) Option {
	return ByInfo(i)
}

// ByName allows to discover service by its name.
func ByName(name string) Option {
	return func(opts *Options) {
		opts.Info.Name = name
	}
}

// ByVersion allows to discover service by its version.
func ByVersion(version string) Option {
	return func(opts *Options) {
		opts.Info.Version = version
	}
}

// ByTag allows to discover service by its tag(s).
func ByTag(tag string) Option {
	return func(opts *Options) {
		opts.Info.Tags = append(opts.Info.Tags, tag)
	}
}

// UsingLBStrategy allows to discover service using specified load balancing strategy.
func UsingLBStrategy(s lb.LoadBalancingStrategy) Option {
	return func(opts *Options) {
		opts.Strategy = s
	}
}
{'fraction_non_alphanumeric': 0.09351145038167939, 'fraction_numerical': 0.0, 'mean_word_length': 3.8537037037037036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5910657', 'n_tokens_mistral': 794, 'n_tokens_neox': 767, 'n_words': 267}