Skip to content

Commit

Permalink
Rename pool.erl to resource_pool.erl to avoid conflict with pool modu…
Browse files Browse the repository at this point in the history
…le from stdlib
  • Loading branch information
seansawyer committed May 20, 2011
1 parent ffba824 commit 86b315a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ebin/mongodb.app
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
{application, mongodb, {application, mongodb,
[{description, "Client interface to MongoDB, also known as the driver. See www.mongodb.org"}, [{description, "Client interface to MongoDB, also known as the driver. See www.mongodb.org"},
{vsn, "0.0"}, {vsn, "0.0"},
{modules, [mongodb_app, mongo, mongo_protocol, mongo_connect, mongo_query, mongo_cursor, mvar, mongodb_tests, mongo_replset, pool]}, {modules, [mongodb_app, mongo, mongo_protocol, mongo_connect, mongo_query, mongo_cursor, mvar, mongodb_tests, mongo_replset, resource_pool]},
{registered, []}, {registered, []},
{applications, [kernel, stdlib]}, {applications, [kernel, stdlib]},
{mod, {mongodb_app, []}} {mod, {mongodb_app, []}}
Expand Down
12 changes: 6 additions & 6 deletions src/mongodb_tests.erl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test() -> eunit:test ({setup,
fun app_test/0, fun app_test/0,
fun connect_test/0, fun connect_test/0,
fun mongo_test/0, fun mongo_test/0,
fun pool_test/0 fun resource_pool_test/0
]}). ]}).


test_rs() -> eunit:test ({setup, test_rs() -> eunit:test ({setup,
Expand Down Expand Up @@ -101,16 +101,16 @@ mongo_test() ->
mongo:disconnect (Conn). mongo:disconnect (Conn).


% Mongod server must be running on 127.0.0.1:27017 % Mongod server must be running on 127.0.0.1:27017
pool_test() -> resource_pool_test() ->
Pool = pool:new (mongo:connect_factory ({"127.0.0.1", 27017}), 2), Pool = resource_pool:new (mongo:connect_factory ({"127.0.0.1", 27017}), 2),
Do = fun (Conn) -> mongo:do (safe, master, Conn, admin, fun () -> mongo:command ({listDatabases, 1}) end) end, Do = fun (Conn) -> mongo:do (safe, master, Conn, admin, fun () -> mongo:command ({listDatabases, 1}) end) end,
lists:foreach (fun (_) -> lists:foreach (fun (_) ->
{ok, Conn} = pool:get (Pool), {ok, Conn} = resource_pool:get (Pool),
{ok, Doc} = Do (Conn), {ok, Doc} = Do (Conn),
{_} = bson:lookup (databases, Doc) end, {_} = bson:lookup (databases, Doc) end,
lists:seq (1,8)), lists:seq (1,8)),
pool:close (Pool), resource_pool:close (Pool),
true = pool:is_closed (Pool). true = resource_pool:is_closed (Pool).


% Replica set named "rs1" must be running on localhost:27017 & 27018 % Replica set named "rs1" must be running on localhost:27017 & 27018
replset_test() -> % TODO: change from connect_test replset_test() -> % TODO: change from connect_test
Expand Down
2 changes: 1 addition & 1 deletion src/pool.erl → src/resource_pool.erl
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
%@doc A set of N resources handed out randomly, and recreated on expiration %@doc A set of N resources handed out randomly, and recreated on expiration
-module (pool). -module (resource_pool).


-export_type ([factory/1, create/1, expire/1, is_expired/1]). -export_type ([factory/1, create/1, expire/1, is_expired/1]).
-export_type ([pool/1]). -export_type ([pool/1]).
Expand Down

0 comments on commit 86b315a

Please sign in to comment.