Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
|
Controls the session pool maintained by a spanner::Client
.
More...
#include <google/cloud/spanner/session_pool_options.h>
Public Member Functions | |
SessionPoolOptions & | EnforceConstraints (int num_channels) |
Enforce the stated constraints on the option values, altering them if necessary. More... | |
SessionPoolOptions & | set_min_sessions (int count) |
Set the minimum number of sessions to keep in the pool. More... | |
int | min_sessions () const |
Return the minimum number of sessions to keep in the pool. More... | |
SessionPoolOptions & | set_max_sessions_per_channel (int count) |
Set the maximum number of sessions to create on each channel. More... | |
int | max_sessions_per_channel () const |
Return the minimum number of sessions to keep in the pool. More... | |
SessionPoolOptions & | set_max_idle_sessions (int count) |
Set the maximum number of sessions to keep in the pool in an idle state. More... | |
int | max_idle_sessions () const |
Return the maximum number of idle sessions to keep in the pool. More... | |
SessionPoolOptions & | set_action_on_exhaustion (ActionOnExhaustion action) |
Set whether to block or fail on pool exhaustion. More... | |
ActionOnExhaustion | action_on_exhaustion () const |
Return the action to take (kBlock or kFail) when attempting to allocate a session when the pool is exhausted. More... | |
SessionPoolOptions & | set_keep_alive_interval (std::chrono::seconds interval) |
std::chrono::seconds | keep_alive_interval () const |
Return the interval at which we refresh sessions to prevent GC. More... | |
SessionPoolOptions & | set_labels (std::map< std::string, std::string > labels) |
Set the labels used when creating sessions within the pool. More... | |
std::map< std::string, std::string > const & | labels () const |
Return the labels used when creating sessions within the pool. More... | |
Controls the session pool maintained by a spanner::Client
.
Creating Cloud Spanner sessions is an expensive operation. The recommended practice is to maintain a cache (or pool) of sessions in the client side. This class controls the initial size of this pool, and how the pool grows (or shrinks) as needed.
Definition at line 48 of file session_pool_options.h.
|
inline |
Return the action to take (kBlock or kFail) when attempting to allocate a session when the pool is exhausted.
Definition at line 115 of file session_pool_options.h.
|
inline |
Enforce the stated constraints on the option values, altering them if necessary.
This can't be done in the setters, since we don't yet know the number of channels, and it would also constrain the order in which the fields must be set.
num_channels
the number of RPC channels in use by the pool.
Definition at line 58 of file session_pool_options.h.
|
inline |
Return the interval at which we refresh sessions to prevent GC.
Definition at line 131 of file session_pool_options.h.
|
inline |
Return the labels used when creating sessions within the pool.
Definition at line 147 of file session_pool_options.h.
|
inline |
Return the maximum number of idle sessions to keep in the pool.
Definition at line 103 of file session_pool_options.h.
|
inline |
Return the minimum number of sessions to keep in the pool.
Definition at line 91 of file session_pool_options.h.
|
inline |
Return the minimum number of sessions to keep in the pool.
Definition at line 79 of file session_pool_options.h.
|
inline |
Set whether to block or fail on pool exhaustion.
Definition at line 106 of file session_pool_options.h.
|
inline |
Definition at line 125 of file session_pool_options.h.
|
inline |
Set the labels used when creating sessions within the pool.
[a-z]([-a-z0-9]{0,61}[a-z0-9])?
.([a-z]([-a-z0-9]{0,61}[a-z0-9])?)?
.Definition at line 141 of file session_pool_options.h.
|
inline |
Set the maximum number of sessions to keep in the pool in an idle state.
Values <= 0 are treated as 0.
Definition at line 97 of file session_pool_options.h.
|
inline |
Set the maximum number of sessions to create on each channel.
Values <= 1 are treated as 1.
Definition at line 85 of file session_pool_options.h.
|
inline |
Set the minimum number of sessions to keep in the pool.
Values <= 0 are treated as 0. This value will effectively be reduced if it exceeds the overall limit on the number of sessions (max_sessions_per_channel
* number of channels).
Definition at line 73 of file session_pool_options.h.