|
libmongo-client 0.1.8
|
These commands implement connection pooling over the mongo_sync family of commands. More...

Functions | |
| mongo_sync_pool * | mongo_sync_pool_new (const gchar *host, gint port, gint nmasters, gint nslaves) |
| Create a new synchronous connection pool. | |
| void | mongo_sync_pool_free (mongo_sync_pool *pool) |
| Close and free a synchronous connection pool. | |
| mongo_sync_pool_connection * | mongo_sync_pool_pick (mongo_sync_pool *pool, gboolean want_master) |
| Pick a connection from a synchronous connection pool. | |
| gboolean | mongo_sync_pool_return (mongo_sync_pool *pool, mongo_sync_pool_connection *conn) |
| Return a connection to the synchronous connection pool. | |
These commands implement connection pooling over the mongo_sync family of commands.
Once a pool is set up, one can pick and return connections at one's leisure. Picking is done in a round-robin fashion (excluding connections that have been picked but not returned yet).
| void mongo_sync_pool_free | ( | mongo_sync_pool * | pool | ) |
Close and free a synchronous connection pool.
| pool | is the pool to shut down. |
| mongo_sync_pool * mongo_sync_pool_new | ( | const gchar * | host, |
| gint | port, | ||
| gint | nmasters, | ||
| gint | nslaves ) |
Create a new synchronous connection pool.
Sets up a connection pool towards a given MongoDB server, and all its secondaries (if any).
| host | is the address of the server. |
| port | is the port to connect to. |
| nmasters | is the number of connections to make towards the master. |
| nslaves | is the number of connections to make towards the secondaries. |
| mongo_sync_pool_connection * mongo_sync_pool_pick | ( | mongo_sync_pool * | pool, |
| gboolean | want_master ) |
Pick a connection from a synchronous connection pool.
Based on given preferences, selects a free connection object from the pool, and returns it.
| pool | is the pool to select from. |
| want_master | flags whether the caller wants a master connection, or secondaries are acceptable too. |
| gboolean mongo_sync_pool_return | ( | mongo_sync_pool * | pool, |
| mongo_sync_pool_connection * | conn ) |
Return a connection to the synchronous connection pool.
Once one is not using a connection anymore, it should be returned to the pool using this function.
| pool | is the pool to return to. |
| conn | is the connection to return. |