anchor.diff:              {true, null}
       end.
   
  -%-spec is_valid_renewal(lease_t()) ->
  -%    fun ((any(), any(), any()) -> {boolean(), renewal_failed_reason() | null}). %% content check
  -%is_valid_renewal(#lease{owner=OldOwner,aux = OldAux,range=OldRange,
  -%                        epoch=OldEpoch,version=OldVersion}) ->
  -%    fun (prbr_bottom, _WriteFilter, _Next) ->
  -%            {false, lease_does_not_exist};
  -%        (#lease{owner = O0}, _, _)    when O0 =/= OldOwner->
  -%            {false, unexpected_owner};
  -%        (#lease{aux = Aux0}, _, _)    when Aux0 =/= OldAux->
  -%            {false, unexpected_aux};
  -%        (#lease{range = R0}, _, _)    when R0 =/= OldRange->
  -%            {false, unexpected_range};
  -%        (#lease{epoch = E0}, _, _)                     when E0 =/= OldEpoch ->
  -%            {false, unexpected_epoch};
  -%        (#lease{version = V0}, _, _)                   when V0 =/= OldVersion->
  -%            {false, unexpected_version};
  -%        (#lease{timeout = T0}, _, #lease{timeout = T1})  when not (T0 < T1)->
  -%            {false, timeout_is_not_newer_than_current_lease}
  -%    end.
  -
   -spec is_valid_update(non_neg_integer(), non_neg_integer()) ->
       fun ((any(), any(), any()) -> {boolean(), update_failed_reason() | null}). %% content check
   is_valid_update(CurrentEpoch, CurrentVersion) ->
  
positive.code:                                | unexpected_version
                                 | timeout_is_not_newer_than_current_lease.
  
  %-type renewal_failed_reason() :: lease_does_not_exist
  %                               | unexpected_owner
  %                               | unexpected_aux
  %                               | unexpected_range
  %                               | unexpected_epoch
  %                               | unexpected_version
  %                               | timeout_is_not_newer_than_current_lease.
  
  -type update_failed_reason() :: lease_does_not_exist
                                | epoch_or_version_mismatch.
  
  -type split_step1_failed_reason() :: lease_already_exists.
  %-type split_step2_failed_reason() :: lease_does_not_exist
  %                                   | epoch_or_version_mismatch
  %                                   | owner_changed
  %                                   | range_unchanged
  %                                   | aux_unchanged
  %                                   | timeout_is_not_newer_than_current_lease
  %                                   | timeout_is_not_in_the_future.
  %
  %-type split_step3_failed_reason() :: lease_does_not_exist
  %                                   | epoch_or_version_mismatch
  %                                   | owner_changed
  %                                   | range_changed
  %                                   | aux_unchanged
  %                                   | timeout_is_not_newer_than_current_lease
  %                                   | timeout_is_not_in_the_future.
  %
  %-type split_step4_failed_reason() :: lease_does_not_exist
  %                                   | epoch_or_version_mismatch
  %                                   | owner_changed
  %                                   | range_changed
  %                                   | aux_unchanged
  %                                   | timeout_is_not_newer_than_current_lease
  %                                   | timeout_is_not_in_the_future.
  
  -spec delta() -> pos_integer().
  delta() -> 10.
  
negative.code:                     {false, lease_already_exists}
              end
      end.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %
  