<commit_before>package mantle

import (
	"github.com/youtube/vitess/go/pools"
	"time"
)

type PoolSettings struct {
	HostAndPorts []string
	Capacity     int
	MaxCapacity  int
	Timeout      time.Duration
}

func (rp *ResourcePool) GetConn() (pools.Resource, error) {
	resource, err := rp.pool.Get()
	if err != nil {
		return nil, err
	}
	return resource, nil
}

func (rp *ResourcePool) PutConn(conn pools.Resource) {
	rp.pool.Put(conn)
}

type ResourcePool struct {
	pool *pools.ResourcePool
}

//The connect callback that is passed by a backend
type dialAndConnect func(hostNPorts []string) (pools.Resource, error)

func NewPool(connect dialAndConnect, settings PoolSettings) *ResourcePool {
	return &ResourcePool{
		pools.NewResourcePool(newRedisFactory(connect, settings.HostAndPorts),
			settings.Capacity, settings.MaxCapacity, settings.Timeout)}
}

func newRedisFactory(connect dialAndConnect, HostAndPorts []string) pools.Factory {
	return func() (pools.Resource, error) {
		return connect(HostAndPorts)
	}
}<commit_msg>lets pass options to settings<commit_after>package mantle

import (
	"github.com/youtube/vitess/go/pools"
	"time"
)

type PoolSettings struct {
	HostAndPorts []string
	Capacity     int
	MaxCapacity  int
	Options      map[string]string
	Timeout      time.Duration
}

func (rp *ResourcePool) GetConn() (pools.Resource, error) {
	resource, err := rp.pool.Get()
	if err != nil {
		return nil, err
	}
	return resource, nil
}

func (rp *ResourcePool) PutConn(conn pools.Resource) {
	rp.pool.Put(conn)
}

type ResourcePool struct {
	pool *pools.ResourcePool
}

//The connect callback that is passed by a backend
type dialAndConnect func(instance interface{}) (pools.Resource, error)

func NewPool(connect dialAndConnect, instance interface{}, settings PoolSettings) *ResourcePool {
	return &ResourcePool{
		pools.NewResourcePool(newRedisFactory(connect, instance),
			settings.Capacity, settings.MaxCapacity, settings.Timeout)}
}

func newRedisFactory(connect dialAndConnect, instance interface{}) pools.Factory {
	return func() (pools.Resource, error) {
		return connect(instance)
	}
}
{'fraction_non_alphanumeric': 0.10546318289786223, 'fraction_numerical': 0.0, 'mean_word_length': 4.982954545454546, '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': '4353942', 'n_tokens_mistral': 683, 'n_tokens_neox': 662, 'n_words': 178}