summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Anderson <brad@cloudant.com>2010-05-27 11:40:24 -0400
committerBrad Anderson <brad@cloudant.com>2010-05-27 11:40:24 -0400
commit7ee5e50622a531e245bac32b9fc2351b632d6482 (patch)
treea19d9d9647ffe424be0a4386b262f4fb5673195e
parent5b68d7349807b6540514ac8b506e80ede3d2fe3d (diff)
parentf399485a90f5d09f6b2df839511756642352031b (diff)
resolved fabric_delete conflict
-rw-r--r--src/fabric_create.erl8
-rw-r--r--src/fabric_delete.erl2
-rw-r--r--src/fabric_info.erl6
3 files changed, 8 insertions, 8 deletions
diff --git a/src/fabric_create.erl b/src/fabric_create.erl
index c2c01ccd..17c85b6a 100644
--- a/src/fabric_create.erl
+++ b/src/fabric_create.erl
@@ -20,7 +20,7 @@ create_db(DbName, Options) ->
{ok, FullNodes} = mem3:fullnodes(),
RefPartMap = send_create_calls(DbName, Options, Fullmap),
Acc0 = {false, length(RefPartMap),
- lists:usort([ {Beg, false} || {_,#part{b=Beg}} <- RefPartMap])},
+ lists:usort([ {Beg, false} || {_,#shard{range=[Beg,_]}} <- RefPartMap])},
case fabric_util:receive_loop(
RefPartMap, 1, fun handle_create_msg/3, Acc0, 5000, infinity) of
{ok, _Results} ->
@@ -37,7 +37,7 @@ create_db(DbName, Options) ->
%% @doc create the partitions on all appropriate nodes (rexi calls)
-spec send_create_calls(binary(), list(), fullmap()) -> [{reference(), part()}].
send_create_calls(DbName, Options, Fullmap) ->
- lists:map(fun(#part{node=Node, b=Beg} = Part) ->
+ lists:map(fun(#shard{node=Node, range=[Beg,_]} = Part) ->
ShardName = showroom_utils:shard_name(Beg, DbName),
Ref = rexi:async_server_call({couch_server, Node},
{create, ShardName, Options}),
@@ -55,7 +55,7 @@ handle_create_msg(_, {rexi_DOWN, _, _, _}, {Complete, _N, _Parts}) ->
end;
handle_create_msg(_, _, {true, 1, _Acc}) ->
{stop, ok};
-handle_create_msg({_, #part{b=Beg}}, {ok, _}, {false, 1, PartResults0}) ->
+handle_create_msg({_, #shard{range=[Beg,_]}}, {ok, _}, {false, 1, PartResults0}) ->
PartResults = lists:keyreplace(Beg, 1, PartResults0, {Beg, true}),
case is_complete(PartResults) of
true -> {stop, ok};
@@ -63,7 +63,7 @@ handle_create_msg({_, #part{b=Beg}}, {ok, _}, {false, 1, PartResults0}) ->
end;
handle_create_msg(_RefPart, {ok, _}, {true, N, Parts}) ->
{ok, {true, N-1, Parts}};
-handle_create_msg({_Ref, #part{b=Beg}}, {ok, _}, {false, Rem, PartResults0}) ->
+handle_create_msg({_Ref, #shard{range=[Beg,_]}}, {ok, _}, {false, Rem, PartResults0}) ->
PartResults = lists:keyreplace(Beg, 1, PartResults0, {Beg, true}),
{ok, {is_complete(PartResults), Rem-1, PartResults}}.
diff --git a/src/fabric_delete.erl b/src/fabric_delete.erl
index d2ee47e8..674f09ad 100644
--- a/src/fabric_delete.erl
+++ b/src/fabric_delete.erl
@@ -35,7 +35,7 @@ delete_db(DbName, Options) ->
%% @doc delete the partitions on all appropriate nodes (rexi calls)
-spec send_calls(binary(), list(), fullmap()) -> [{reference(), part()}].
send_calls(DbName, Options, Parts) ->
- lists:map(fun(#part{node=Node, b=Beg} = Part) ->
+ lists:map(fun(#shard{node=Node, range=[Beg,_]} = Part) ->
ShardName = showroom_utils:shard_name(Beg, DbName),
Ref = rexi:async_server_call({couch_server, Node},
{delete, ShardName, Options}),
diff --git a/src/fabric_info.erl b/src/fabric_info.erl
index 90cd11f0..662c06b6 100644
--- a/src/fabric_info.erl
+++ b/src/fabric_info.erl
@@ -8,13 +8,13 @@
%% @doc gets all databases in the cluster.
-spec all_databases(binary() | []) -> [binary()].
all_databases([]) ->
- Dbs = ets:foldl(fun(#part{dbname=DbName}, AccIn) ->
+ Dbs = ets:foldl(fun(#shard{dbname=DbName}, AccIn) ->
new_acc(DbName, AccIn)
end, [], partitions),
{ok, Dbs};
all_databases(Customer) ->
?debugFmt("~nCustomer: ~p~n", [Customer]),
- Dbs = ets:foldl(fun(#part{dbname=DbName}, AccIn) ->
+ Dbs = ets:foldl(fun(#shard{dbname=DbName}, AccIn) ->
DbNameStr = ?b2l(DbName),
case string:str(DbNameStr, Customer) of
1 ->
@@ -44,7 +44,7 @@ new_acc(DbName, Acc) ->
end.
send_info_calls(DbName, Parts) ->
- lists:map(fun(#part{node=Node, b=Beg} = Part) ->
+ lists:map(fun(#shard{node=Node, range=[Beg,_]} = Part) ->
ShardName = showroom_utils:shard_name(Beg, DbName),
Ref = rexi:cast(Node, {rexi_rpc, get_db_info, ShardName}),
{Ref, Part}