Permalink
Browse files

fix ddfs node so it works with no volumes

  • Loading branch information...
Ville Tuulos
Ville Tuulos committed May 2, 2011
1 parent e32802a commit c0d0040d3e4c7c8b4e39031a30a9f73eeb39a5fd
Showing with 6 additions and 0 deletions.
  1. +4 −0 master/src/ddfs/ddfs_node.erl
  2. +2 −0 master/src/ddfs/ddfs_put.erl
@@ -150,6 +150,8 @@ do_get_diskspace(#state{vols = Vols}) ->
-spec do_put_blob(nonempty_string(), {pid(), _}, #state{}) ->
{'reply', 'full', #state{}} | {'noreply', #state{}}.
+do_put_blob(_BlobName, _From, #state{vols = []} = S) ->
+ {reply, {error, no_volumes}, S};
do_put_blob(BlobName, {Pid, _Ref} = From, #state{putq = Q} = S) ->
Reply = fun() ->
{_Space, VolName} = choose_vol(S#state.vols),
@@ -200,6 +202,8 @@ do_get_tag_data(Tag, VolName, From, S) ->
end.
-spec do_put_tag_data(binary(), binary(), #state{}) -> {'ok', binary()} | {'error', _}.
+do_put_tag_data(_Tag, _Data, #state{vols = []}) ->
+ {error, no_volumes};
do_put_tag_data(Tag, Data, S) ->
{_Space, VolName} = choose_vol(S#state.vols),
{ok, Local, _} = ddfs_util:hashdir(Tag,
@@ -40,6 +40,8 @@ loop("/ddfs/" ++ BlobName, Req) ->
{error, Path, Error} ->
error_reply(Req, "Could not create path for blob",
Path, Error);
+ {error, no_volumes} ->
+ Req:respond({500, [], "No volumes"});
_ ->
Req:respond({503, [],
["Maximum number of uploaders reached. ",

0 comments on commit c0d0040

Please sign in to comment.