Last active
January 1, 2021 07:39
-
-
Save Happytreat/64f7c3c4a1e3457bf9345fa657f55eb3 to your computer and use it in GitHub Desktop.
Connection Pool Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ConnectionPool interface { | |
// This gets an active connection from the connection pool if exists, | |
// else create a new connection. | |
Get() (net.Conn, error) | |
// This releases an active connection back to the connection pool. | |
Release(conn net.Conn) error | |
// This discards an active connection from the connection pool and | |
// closes the connection. | |
Discard(conn net.Conn) error | |
// Enter the connection pool into a state of inactive. All active | |
// connections in the pool will be closed. In the inactive state, | |
// the pool will no longer return connections when Get() is called | |
// and Release(conn) will close the conn instead. | |
EnterInactiveState() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment