Skip to content

v2: improve pool.Connect interface #356

Closed

Description

The current interface:

func Connect(ctx context.Context, dialers map[string]tarantool.Dialer, connOpts tarantool.Opts) (*ConnectionPool, error)

It has two disadvantages:

  1. It does not allow to use different connect options for different connections.
  2. It could be tricky to initialize a map of dialers.

I suggest a small refactoring:

  1. 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
}
  1. Update the pool.Connect interface:
func Connect(ctx context.Context, servers ...Server) (*ConnectionPool, error)
  1. Update pool.ConnectWithOpts:
func ConnectWithOpts(ctx context.Context, opts Opts, servers ...Server) (*ConnectionPool, error)
  1. 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

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions