@@ -2,15 +2,34 @@ package pool
22
33import "github.com/tarantool/go-tarantool/v2"
44
5+ // BalancerFactory is an interface for creating a balancing pool of connections.
56type BalancerFactory interface {
7+ // Create initializes a new BalancingPool with the specified size.
8+ // The size parameter indicates the intended number of connections to manage within the pool.
69 Create (size int ) BalancingPool
710}
811
12+ // BalancingPool represents a connection pool with load balancing.
913type BalancingPool interface {
14+ // GetConnection returns the connection associated with the specified identifier.
15+ // If no connection with the given identifier is found, it returns nil.
1016 GetConnection (string ) * tarantool.Connection
17+
18+ // DeleteConnection removes the connection with the specified identifier from the pool
19+ // and returns the removed connection. If no connection is found, it returns nil.
1120 DeleteConnection (string ) * tarantool.Connection
21+
22+ // AddConnection adds a new connection to the pool under the specified identifier.
23+ // If a connection with that identifier already exists, the behavior may depend
24+ // on the implementation (e.g., it may overwrite the existing connection).
1225 AddConnection (id string , conn * tarantool.Connection )
26+
27+ // GetNextConnection returns the next available connection from the pool.
28+ // The implementation may use load balancing algorithms to select the connection.
1329 GetNextConnection () * tarantool.Connection
30+
31+ // GetConnections returns the current map of all connections in the pool,
32+ // where the key is the connection identifier and the value is a pointer to the connection object.
1433 GetConnections () map [string ]* tarantool.Connection
1534}
1635
0 commit comments