38 lines
991 B
C
Raw Normal View History

2011-05-11 11:41:08 -05:00
#ifndef MOD_MONGO_H
#define MOD_MONGO_H
#include <client/dbclient.h>
#include <client/connpool.h>
#include <db/json.h>
#include <bson/bson.h>
using namespace mongo;
typedef struct {
2011-09-12 09:16:56 +02:00
char *conn_str;
2011-05-11 11:41:08 -05:00
switch_size_t min_connections;
switch_size_t max_connections;
switch_size_t size;
switch_queue_t *connections;
switch_mutex_t *mutex;
switch_memory_pool_t *pool;
} mongo_connection_pool_t;
2011-09-12 09:16:56 +02:00
switch_status_t mongo_connection_create(DBClientBase **connection, const char *conn_str);
void mongo_connection_destroy(DBClientBase **conn);
2011-05-12 10:29:55 +02:00
2011-05-11 11:41:08 -05:00
switch_status_t mongo_connection_pool_create(mongo_connection_pool_t **conn_pool, switch_size_t min_connections, switch_size_t max_connections,
2011-09-12 09:16:56 +02:00
const char *conn_str);
2011-05-11 11:41:08 -05:00
void mongo_connection_pool_destroy(mongo_connection_pool_t **conn_pool);
2011-09-12 09:16:56 +02:00
DBClientBase *mongo_connection_pool_get(mongo_connection_pool_t *conn_pool);
switch_status_t mongo_connection_pool_put(mongo_connection_pool_t *conn_pool, DBClientBase *conn);
2011-05-11 11:41:08 -05:00
#endif