Documentation ¶
Index ¶
Constants ¶
View Source
const (
MAX_CONNECTIONS string = "max connections met"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewPool ¶
NewPool:
initialize the connection pool. the purpose of the connection pool is to reuse connections once they have been made, minimizing overhead for reconnecting to a host every time an rpc is made. the pool has the following structure: { [key: address/host]: Array<connections> }
func (*Pool) CloseConnections ¶
CloseConnections:
1.) load connections for the particular host/address 2.) if the address was loaded from the thread safe map: if the connection already exists in the map, close the connection 3.) remove the key from the map
func (*Pool) GetConnection ¶
GetConnection:
1.) load connections for the particular host/address 2.) if the address was loaded from the thread safe map: if the total connections in the map is greater than max connections specified throw max connections error otherwise for each connection in the array of connections, if the connection is not null and the connection is ready for work, return the connection 3.) if the address was not loaded, create a new grpc connection and store the new connection at the key associated with the address/host and return the new connection for grpc connection opts, we will automatically compress the rpc on the wire
func (*Pool) PutConnection ¶
PutConnection:
1.) load connections for the particular host/address 2.) if the address was loaded from the thread safe map: if the connection already exists in the map, return otherwise, close the connection and return
Click to show internal directories.
Click to hide internal directories.