Projection store private write returns bad_arg if max_public_epochid is greater
This commit is contained in:
parent
58d840ef7e
commit
9768f3c035
1 changed files with 11 additions and 1 deletions
|
@ -261,7 +261,17 @@ do_proj_read(ProjType, Epoch, S_or_Dir) ->
|
|||
{{error, Else}, S_or_Dir}
|
||||
end.
|
||||
|
||||
do_proj_write(ProjType, #projection_v1{epoch_number=Epoch}=Proj, S) ->
|
||||
do_proj_write(public=ProjType, Proj, S) ->
|
||||
do_proj_write2(ProjType, Proj, S);
|
||||
do_proj_write(private=ProjType, #projection_v1{epoch_number=Epoch}=Proj, S) ->
|
||||
case S#state.max_public_epochid of
|
||||
{PublicEpoch, _} when PublicEpoch =< Epoch ->
|
||||
do_proj_write2(ProjType, Proj, S);
|
||||
{PublicEpoch, _} ->
|
||||
{{error, bad_arg}, S}
|
||||
end.
|
||||
|
||||
do_proj_write2(ProjType, #projection_v1{epoch_number=Epoch}=Proj, S) ->
|
||||
%% TODO: We probably ought to check the projection checksum for sanity, eh?
|
||||
Dir = pick_path(ProjType, S),
|
||||
Path = filename:join(Dir, epoch2name(Epoch)),
|
||||
|
|
Loading…
Reference in a new issue