From 8b2be0133e9d4105491a90dcccd2945dd1e0558d Mon Sep 17 00:00:00 2001 From: maxim-konovalov Date: Wed, 1 May 2024 12:39:32 +0300 Subject: [PATCH] pool: add missing methods to the pooler interface I added methods that are implemented but not included in the pooler interface. --- CHANGELOG.md | 2 ++ pool/pooler.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5cc700ea..4ef3cb4e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release. connection and ctx is not canceled; also added logs for error case of `ConnectionPool.tryConnect()` calls in `ConnectionPool.controller()` and `ConnectionPool.reconnect()` +- Methods that are implemented but not included in the pooler interface (#395). + ### Changed ### Fixed diff --git a/pool/pooler.go b/pool/pooler.go index 975162d37..d4c0f1b5e 100644 --- a/pool/pooler.go +++ b/pool/pooler.go @@ -1,15 +1,28 @@ package pool import ( + "context" "time" "github.com/tarantool/go-tarantool/v2" ) +// TopologyEditor is the interface that must be implemented by a connection pool. +// It describes edit topology methods. +type TopologyEditor interface { + Add(ctx context.Context, instance Instance) error + Remove(name string) error +} + // Pooler is the interface that must be implemented by a connection pool. type Pooler interface { + TopologyEditor + ConnectedNow(mode Mode) (bool, error) Close() []error + // CloseGraceful closes connections in the ConnectionPool gracefully. It waits + // for all requests to complete. + CloseGraceful() []error ConfiguredTimeout(mode Mode) (time.Duration, error) NewPrepared(expr string, mode Mode) (*tarantool.Prepared, error) NewStream(mode Mode) (*tarantool.Stream, error)