Skip to content
Browse files

proper file structure

  • Loading branch information...
1 parent 117dd11 commit 5837b7b0c2dce8749a7d445094e5d2b3b32f6a00 @SergejJurecko committed Aug 17, 2010
View
1 Emakefile
@@ -0,0 +1 @@
+{['src/*'],[{outdir,"ebin"}]}.
View
0 erlmongo.app → ebin/erlmongo.app
File renamed without changes.
View
0 erlmongo.hrl → src/erlmongo.hrl
File renamed without changes.
View
0 erlmongo_app.erl → src/erlmongo_app.erl
File renamed without changes.
View
0 mongoapi.erl → src/mongoapi.erl
File renamed without changes.
View
36 mongodb.erl → src/mongodb.erl
@@ -162,16 +162,8 @@ exec_getmore(Pool,Col, C) ->
end
end.
exec_delete(Pool,Collection, D) ->
- % case gen_server:call(?MODULE, {getwrite,Pool}) of
- % undefined ->
- % not_connected;
- % PID ->
- % PID ! {delete, Collection, D},
- % ok
- % end.
trysend(Pool,{delete,Collection,D},1).
exec_find(Pool,Collection, Quer) ->
- % case gen_server:call(?MODULE, {getread,Pool}) of
case trysend(Pool,{find, self(), Collection, Quer},1) of
ok ->
receive
@@ -184,22 +176,8 @@ exec_find(Pool,Collection, Quer) ->
X
end.
exec_insert(Pool,Collection, D) ->
- % case gen_server:call(?MODULE, {getwrite,Pool}) of
- % undefined ->
- % not_connected;
- % PID ->
- % PID ! {insert, Collection, D},
- % ok
- % end.
trysend(Pool,{insert,Collection,D},1).
exec_update(Pool,Collection, D) ->
- % case gen_server:call(?MODULE, {getwrite,Pool}) of
- % undefined ->
- % not_connected;
- % PID ->
- % PID ! {update, Collection, D},
- % ok
- % end.
trysend(Pool,{update,Collection,D},1).
exec_cmd(Pool,DB, Cmd) ->
Quer = #search{ndocs = 1, nskip = 0, criteria = mongodb:encode(Cmd)},
@@ -708,15 +686,21 @@ connection(#con{} = P,Index,Buf) ->
ifmaster ->
self() ! {find, Source, <<"admin.$cmd">>, #search{nskip = 0, ndocs = 1, criteria = mongodb:encode([{<<"ismaster">>, 1}])}};
_ ->
+ case whereis(Pool) of
+ undefined ->
+ ok;
+ EProc ->
+ EProc ! {stop},
+ timer:sleep(30)
+ end,
register(Pool,self()),
Source ! {conn_established, Pool, Type, self()}
end,
connection(#con{sock = Sock},1, <<>>);
{tcp_closed, _} ->
exit(stop)
end.
-readpacket(Bin) ->
- <<ComplSize:32/little, _ReqID:32/little,RespID:32/little,_OpCode:32/little, Body/binary>> = Bin,
+readpacket(<<ComplSize:32/little, _ReqID:32/little,RespID:32/little,_OpCode:32/little, Body/binary>> = Bin) ->
BodySize = ComplSize-16,
case Body of
<<Packet:BodySize/binary,Rem/binary>> ->
@@ -735,7 +719,9 @@ readpacket(Bin) ->
end;
_ ->
Bin
- end.
+ end;
+readpacket(Bin) ->
+ Bin.
constr_header(Len, ID, RespTo, OP) ->
View
0 mongodb_supervisor.erl → src/mongodb_supervisor.erl
File renamed without changes.

0 comments on commit 5837b7b

Please sign in to comment.
Something went wrong with that request. Please try again.