Closed
Description
The current interface:
func Connect(ctx context.Context, dialers map[string]tarantool.Dialer, connOpts tarantool.Opts) (*ConnectionPool, error)
It has two disadvantages:
- It does not allow to use different connect options for different connections.
- It could be tricky to initialize a map of dialers.
I suggest a small refactoring:
- Add the
Server
type to the pool package, which would describe one server for a pool:
type Server struct {
Id string
Dialer tarantool.Dialer
Opts tarantool.Opts
}
- Update the
pool.Connect
interface:
func Connect(ctx context.Context, servers ...Server) (*ConnectionPool, error)
- Update
pool.ConnectWithOpts
:
func ConnectWithOpts(ctx context.Context, opts Opts, servers ...Server) (*ConnectionPool, error)
- Update
pool.Add
:
func (p *ConnectionPool) Add(ctx context.Context, server Server) error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment