Storage Engine API
mongo::MobileSessionPool Class Referencefinal

This class manages a pool of open sqlite3* objects. More...

#include <mobile_session_pool.h>

Detailed Description

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< MobileSessiongetSession (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
 

Member Typedef Documentation

◆ SessionPool

using mongo::MobileSessionPool::SessionPool = std::vector<sqlite3*>
private

Constructor & Destructor Documentation

◆ MobileSessionPool()

mongo::MobileSessionPool::MobileSessionPool ( const std::string &  path,
std::uint64_t  maxPoolSize = 80 
)

◆ ~MobileSessionPool()

mongo::MobileSessionPool::~MobileSessionPool ( )

Member Function Documentation

◆ _popSession_inlock()

sqlite3 * mongo::MobileSessionPool::_popSession_inlock ( )
private

Gets the front element from _sessions and then pops it off the queue.

◆ getSession()

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.

◆ MONGO_DISALLOW_COPYING()

mongo::MobileSessionPool::MONGO_DISALLOW_COPYING ( MobileSessionPool  )
private

◆ releaseSession()

void mongo::MobileSessionPool::releaseSession ( MobileSession session)

Returns a session to the pool for later reuse.

◆ shutDown()

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.

Member Data Documentation

◆ _curPoolSize

std::uint64_t mongo::MobileSessionPool::_curPoolSize = 0
private

◆ _maxPoolSize

std::uint64_t mongo::MobileSessionPool::_maxPoolSize = 80
private

PoolSize is the number of open sessions associated with the session pool.

◆ _mutex

stdx::mutex mongo::MobileSessionPool::_mutex
private

◆ _path

std::string mongo::MobileSessionPool::_path
private

◆ _releasedSessionNotifier

stdx::condition_variable mongo::MobileSessionPool::_releasedSessionNotifier
private

◆ _sessions

SessionPool mongo::MobileSessionPool::_sessions
private

◆ _shuttingDown

bool mongo::MobileSessionPool::_shuttingDown = false
private

◆ failedDropsQueue

MobileDelayedOpQueue mongo::MobileSessionPool::failedDropsQueue

The documentation for this class was generated from the following files: