Oops, fix PB stuff to add witnesses
This commit is contained in:
parent
3f51357577
commit
91496c656b
3 changed files with 23 additions and 15 deletions
|
@ -304,16 +304,17 @@ message Mpb_ProjectionV1 {
|
||||||
required bytes epoch_csum = 2;
|
required bytes epoch_csum = 2;
|
||||||
required string author_server = 3;
|
required string author_server = 3;
|
||||||
repeated string all_members = 4;
|
repeated string all_members = 4;
|
||||||
required Mpb_Now creation_time = 5;
|
repeated string witnesses = 5;
|
||||||
required Mpb_Mode mode = 6;
|
required Mpb_Now creation_time = 6;
|
||||||
repeated string upi = 7;
|
required Mpb_Mode mode = 7;
|
||||||
repeated string repairing = 8;
|
repeated string upi = 8;
|
||||||
repeated string down = 9;
|
repeated string repairing = 9;
|
||||||
optional bytes opaque_flap = 10;
|
repeated string down = 10;
|
||||||
optional bytes opaque_inner = 11;
|
optional bytes opaque_flap = 11;
|
||||||
required bytes opaque_dbg = 12;
|
optional bytes opaque_inner = 12;
|
||||||
required bytes opaque_dbg2 = 13;
|
required bytes opaque_dbg = 13;
|
||||||
repeated Mpb_MembersDictEntry members_dict = 14;
|
required bytes opaque_dbg2 = 14;
|
||||||
|
repeated Mpb_MembersDictEntry members_dict = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
|
@ -215,7 +215,7 @@ init({MyName, InitMembersDict, MgrOpts}) ->
|
||||||
random:seed(now()),
|
random:seed(now()),
|
||||||
init_remember_partition_hack(),
|
init_remember_partition_hack(),
|
||||||
ZeroAll_list = [P#p_srvr.name || {_,P} <- orddict:to_list(InitMembersDict)],
|
ZeroAll_list = [P#p_srvr.name || {_,P} <- orddict:to_list(InitMembersDict)],
|
||||||
ZeroProj = make_none_projection(MyName, ZeroAll_list, InitMembersDict),
|
ZeroProj = make_none_projection(MyName, ZeroAll_list, [], InitMembersDict),
|
||||||
ok = store_zeroth_projection_maybe(ZeroProj, MgrOpts),
|
ok = store_zeroth_projection_maybe(ZeroProj, MgrOpts),
|
||||||
|
|
||||||
{MembersDict, Proj} =
|
{MembersDict, Proj} =
|
||||||
|
@ -360,10 +360,11 @@ code_change(_OldVsn, S, _Extra) ->
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
make_none_projection(MyName, All_list, MembersDict) ->
|
make_none_projection(MyName, All_list, Witness_list, MembersDict) ->
|
||||||
Down_list = All_list,
|
Down_list = All_list,
|
||||||
UPI_list = [],
|
UPI_list = [],
|
||||||
machi_projection:new(MyName, MembersDict, Down_list, UPI_list, [], []).
|
P = machi_projection:new(MyName, MembersDict, Down_list, UPI_list, [], []),
|
||||||
|
machi_projection:update_checksum(P#projection_v1{witnesses=Witness_list}).
|
||||||
|
|
||||||
get_my_private_proj_boot_info(MgrOpts, DefaultDict, DefaultProj) ->
|
get_my_private_proj_boot_info(MgrOpts, DefaultDict, DefaultProj) ->
|
||||||
get_my_proj_boot_info(MgrOpts, DefaultDict, DefaultProj, private).
|
get_my_proj_boot_info(MgrOpts, DefaultDict, DefaultProj, private).
|
||||||
|
@ -666,7 +667,8 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
|
||||||
P = case NewUPI -- OldWitness_list of
|
P = case NewUPI -- OldWitness_list of
|
||||||
[] ->
|
[] ->
|
||||||
io:format(user, "\nNONE proj ~p\n", [OldEpochNum+1]),
|
io:format(user, "\nNONE proj ~p\n", [OldEpochNum+1]),
|
||||||
NP = make_none_projection(MyName, OldAll_list, MembersDict),
|
NP = make_none_projection(MyName, OldAll_list, OldWitness_list,
|
||||||
|
MembersDict),
|
||||||
NP#projection_v1{epoch_number=OldEpochNum + 1};
|
NP#projection_v1{epoch_number=OldEpochNum + 1};
|
||||||
_ ->
|
_ ->
|
||||||
machi_projection:new(OldEpochNum + 1,
|
machi_projection:new(OldEpochNum + 1,
|
||||||
|
@ -1549,7 +1551,8 @@ react_to_env_C103(#projection_v1{epoch_number=Epoch_latest,
|
||||||
#projection_v1{epoch_number=Epoch_latest,
|
#projection_v1{epoch_number=Epoch_latest,
|
||||||
all_members=All_list,
|
all_members=All_list,
|
||||||
members_dict=MembersDict} = P_latest,
|
members_dict=MembersDict} = P_latest,
|
||||||
P_none0 = make_none_projection(MyName, All_list, MembersDict),
|
#projection_v1{witnesses=Witness_list} = P_current,
|
||||||
|
P_none0 = make_none_projection(MyName, All_list, Witness_list, MembersDict),
|
||||||
P_none1 = P_none0#projection_v1{epoch_number=Epoch_latest,
|
P_none1 = P_none0#projection_v1{epoch_number=Epoch_latest,
|
||||||
dbg=[{none_projection,true}]},
|
dbg=[{none_projection,true}]},
|
||||||
P_none = machi_projection:update_checksum(P_none1),
|
P_none = machi_projection:update_checksum(P_none1),
|
||||||
|
|
|
@ -693,6 +693,7 @@ conv_to_projection_v1(#mpb_projectionv1{epoch_number=Epoch,
|
||||||
epoch_csum=CSum,
|
epoch_csum=CSum,
|
||||||
author_server=Author,
|
author_server=Author,
|
||||||
all_members=AllMembers,
|
all_members=AllMembers,
|
||||||
|
witnesses=Witnesses,
|
||||||
creation_time=CTime,
|
creation_time=CTime,
|
||||||
mode=Mode,
|
mode=Mode,
|
||||||
upi=UPI,
|
upi=UPI,
|
||||||
|
@ -707,6 +708,7 @@ conv_to_projection_v1(#mpb_projectionv1{epoch_number=Epoch,
|
||||||
epoch_csum=CSum,
|
epoch_csum=CSum,
|
||||||
author_server=to_atom(Author),
|
author_server=to_atom(Author),
|
||||||
all_members=[to_atom(X) || X <- AllMembers],
|
all_members=[to_atom(X) || X <- AllMembers],
|
||||||
|
witnesses=[to_atom(X) || X <- Witnesses],
|
||||||
creation_time=conv_to_now(CTime),
|
creation_time=conv_to_now(CTime),
|
||||||
mode=conv_to_mode(Mode),
|
mode=conv_to_mode(Mode),
|
||||||
upi=[to_atom(X) || X <- UPI],
|
upi=[to_atom(X) || X <- UPI],
|
||||||
|
@ -863,6 +865,7 @@ conv_from_projection_v1(#projection_v1{epoch_number=Epoch,
|
||||||
epoch_csum=CSum,
|
epoch_csum=CSum,
|
||||||
author_server=Author,
|
author_server=Author,
|
||||||
all_members=AllMembers,
|
all_members=AllMembers,
|
||||||
|
witnesses=Witnesses,
|
||||||
creation_time=CTime,
|
creation_time=CTime,
|
||||||
mode=Mode,
|
mode=Mode,
|
||||||
upi=UPI,
|
upi=UPI,
|
||||||
|
@ -877,6 +880,7 @@ conv_from_projection_v1(#projection_v1{epoch_number=Epoch,
|
||||||
epoch_csum=CSum,
|
epoch_csum=CSum,
|
||||||
author_server=to_list(Author),
|
author_server=to_list(Author),
|
||||||
all_members=[to_list(X) || X <- AllMembers],
|
all_members=[to_list(X) || X <- AllMembers],
|
||||||
|
witnesses=[to_list(X) || X <- Witnesses],
|
||||||
creation_time=conv_from_now(CTime),
|
creation_time=conv_from_now(CTime),
|
||||||
mode=conv_from_mode(Mode),
|
mode=conv_from_mode(Mode),
|
||||||
upi=[to_list(X) || X <- UPI],
|
upi=[to_list(X) || X <- UPI],
|
||||||
|
|
Loading…
Reference in a new issue