From f399485a90f5d09f6b2df839511756642352031b Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Thu, 27 May 2010 10:52:51 -0400 Subject: replace #part with #shard --- src/fabric_create.erl | 8 ++++---- src/fabric_delete.erl | 6 +++--- src/fabric_info.erl | 6 +++--- 3 files changed, 10 insertions(+), 10 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 d1148e40..90108d3a 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}), @@ -53,7 +53,7 @@ handle_delete_msg(_, {rexi_DOWN, _, _, _}, {Complete, _N, _Parts}) -> end; handle_delete_msg(_, _, {true, 1, _Acc}) -> {stop, ok}; -handle_delete_msg({_, #part{b=Beg}}, {ok, _}, {false, 1, PartResults0}) -> +handle_delete_msg({_, #shard{range=[Beg,_]}}, {ok, _}, {false, 1, PartResults0}) -> PartResults = lists:keyreplace(Beg, 1, PartResults0, {Beg, true}), case is_complete(PartResults) of true -> {stop, ok}; @@ -61,7 +61,7 @@ handle_delete_msg({_, #part{b=Beg}}, {ok, _}, {false, 1, PartResults0}) -> end; handle_delete_msg(_RefPart, {ok, _}, {true, N, Parts}) -> {ok, {true, N-1, Parts}}; -handle_delete_msg({_Ref, #part{b=Beg}}, {ok, _}, {false, Rem, PartResults0}) -> +handle_delete_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_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} -- cgit v1.2.3