![]() |
Storage Engine API
|
This class manages a pool of open sqlite3* objects. More...
#include <mobile_session_pool.h>
This class manages a pool of open sqlite3* objects.
Public Member Functions | |
MobileSessionPool (const std::string &path, std::uint64_t maxPoolSize=80) | |
~MobileSessionPool () | |
std::unique_ptr< MobileSession > | getSession (OperationContext *opCtx) |
Returns a smart pointer to a previously released session for reuse, or creates a new session. More... | |
void | releaseSession (MobileSession *session) |
Returns a session to the pool for later reuse. More... | |
void | shutDown () |
Transitions the pool to shutting down mode. More... | |
Public Attributes | |
MobileDelayedOpQueue | failedDropsQueue |
Private Types | |
using | SessionPool = std::vector< sqlite3 * > |
Private Member Functions | |
MONGO_DISALLOW_COPYING (MobileSessionPool) | |
sqlite3 * | _popSession_inlock () |
Gets the front element from _sessions and then pops it off the queue. More... | |
Private Attributes | |
stdx::mutex | _mutex |
stdx::condition_variable | _releasedSessionNotifier |
std::string | _path |
std::uint64_t | _maxPoolSize = 80 |
PoolSize is the number of open sessions associated with the session pool. More... | |
std::uint64_t | _curPoolSize = 0 |
bool | _shuttingDown = false |
SessionPool | _sessions |
|
private |
mongo::MobileSessionPool::MobileSessionPool | ( | const std::string & | path, |
std::uint64_t | maxPoolSize = 80 |
||
) |
mongo::MobileSessionPool::~MobileSessionPool | ( | ) |
|
private |
Gets the front element from _sessions and then pops it off the queue.
std::unique_ptr< MobileSession > mongo::MobileSessionPool::getSession | ( | OperationContext * | opCtx | ) |
Returns a smart pointer to a previously released session for reuse, or creates a new session.
|
private |
void mongo::MobileSessionPool::releaseSession | ( | MobileSession * | session | ) |
Returns a session to the pool for later reuse.
void mongo::MobileSessionPool::shutDown | ( | ) |
Transitions the pool to shutting down mode.
It waits until all sessions are released back into the pool and closes all open sessions.
|
private |
|
private |
PoolSize is the number of open sessions associated with the session pool.
|
private |
|
private |
|
private |
|
private |
|
private |
MobileDelayedOpQueue mongo::MobileSessionPool::failedDropsQueue |