Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update types and Readme that referred to old pool name

  • Loading branch information...
commit 5cbf4dedc62eed98df4f1263b59e1c927571b9fe 1 parent 8ad7b12
Tony Hannan authored
Showing with 11 additions and 11 deletions.
  1. +6 −6 README.md
  2. +1 −1  ebin/mongodb.app
  3. +4 −4 src/mongo.erl
View
12 README.md
@@ -75,20 +75,20 @@ This driver does not provide helper functions for commands. Use `mongo:command`
### Pooling
-A single (replset-)connection is thread-safe, i.e. multiple `mongo:do` actions can access it simultaneously. However, if you want to increase concurrency by using multiple connection simultaneously, you can create a pool of connections using the generic `pool` module with the appropriate factory object supplied by `mongo` module.
+A single (replset-)connection is thread-safe, i.e. multiple `mongo:do` actions can access it simultaneously. However, if you want to increase concurrency by using multiple connection simultaneously, you can create a pool of connections using the generic `resource_pool` module with the appropriate factory object supplied by `mongo` module.
To create a connection pool of max size 10 to a single Host
- > Pool = pool:new (mongo:connect_factory (Host), 10).
+ > Pool = resource_pool:new (mongo:connect_factory (Host), 10).
To create a rs-connection pool of max size 10 to a Replset
- > Pool = pool:new (mongo:rs_connect_factory (Replset), 10).
+ > Pool = resource_pool:new (mongo:rs_connect_factory (Replset), 10).
To get a (replset-)connection from the pool
- > {ok, Conn} = pool:get (Pool).
+ > {ok, Conn} = resource_pool:get (Pool).
-`Conn` can then be supplied to `mongo:do`. `pool:get` will return `{error, Reason}` if can't connect.
+`Conn` can then be supplied to `mongo:do`. `resource_pool:get` will return `{error, Reason}` if can't connect.
-Close the pool when done using it and all its connection that were handed out via `pool:close`. It will close all its connections, as well as itself.
+Close the pool when done using it and all its connection that were handed out via `resource_pool:close`. It will close all its connections, as well as itself.
View
2  ebin/mongodb.app
@@ -1,6 +1,6 @@
{application, mongodb,
[{description, "Client interface to MongoDB, also known as the driver. See www.mongodb.org"},
- {vsn, "0.0"},
+ {vsn, "0.2.1"},
{modules, [mongodb_app, mongo, mongo_protocol, mongo_connect, mongo_query, mongo_cursor, mvar, mongodb_tests, mongo_replset, resource_pool]},
{registered, []},
{applications, [kernel, stdlib]},
View
8 src/mongo.erl
@@ -47,8 +47,8 @@ connect (Host) -> mongo_connect:connect (Host).
%@doc Close connection to server
disconnect (Conn) -> mongo_connect:close (Conn).
--spec connect_factory (host()) -> pool:factory(connection()).
-%@doc Factory for use with a connection pool. See pool module.
+-spec connect_factory (host()) -> resource_pool:factory(connection()).
+%@doc Factory for use with a connection pool. See resource_pool module.
connect_factory (Host) -> {Host, fun connect/1, fun disconnect/1, fun mongo_connect:is_closed/1}.
% Replica Set %
@@ -64,8 +64,8 @@ rs_connect (Replset) -> mongo_replset:connect (Replset).
%@doc Close cache of replset connections
rs_disconnect (ReplsetConn) -> mongo_replset:close (ReplsetConn).
--spec rs_connect_factory (replset()) -> pool:factory(rs_connection()).
-%@doc Factory for use with a rs_connection pool. See pool module.
+-spec rs_connect_factory (replset()) -> resource_pool:factory(rs_connection()).
+%@doc Factory for use with a rs_connection pool. See resource_pool module.
rs_connect_factory (Replset) -> {Replset, fun (RS) -> RC = rs_connect (RS), {ok, RC} end, fun rs_disconnect/1, fun mongo_replset:is_closed/1}.
% Action %
Please sign in to comment.
Something went wrong with that request. Please try again.