anchor.diff:                        )
           end.
   
  +-spec read(lease_id(), comm:erl_local_pid_plain()) -> ok.
  +read(Key, Pid) ->
  +%% decide which lease db is responsible, ie. if the key is from
  +%% the first quarter of the ring, use lease_db1, if from 2nd
  +%% quarter -> use lease_db2, ...
  +    DB = erlang:list_to_existing_atom(
  +           lists:flatten(
  +             io_lib:format("lease_db~p", [?RT:get_key_segment(Key, 4)]))),
  +
  +%% perform qread
  +    rbrcseq:qread(DB, Pid, Key).
  +
   write(Key, Value, ContentCheck) ->
       %% decide which lease db is responsible, ie. if the key is from
       %% the first quarter of the ring, use lease_db1, if from 2nd
  
positive.code: 
  %% -type ldb_entry() :: lease_entry().
  
  -spec lease_renew(lease_entry()) -> {ok}.
  lease_renew(Old = #lease{id=Id, version=OldVersion}) ->
      Timeout = util:time_plus_s(os:timestamp(), delta()),
      New = Old#lease{version=OldVersion+1, timeout=Timeout},
      write(Id, New, fun l_on_cseq:is_valid_renewal/3).
  
  -spec lease_handover(lease_entry(), comm:this()) -> {ok}.
  %% dht_node must remove its old version from its cache immediately
  lease_handover(Old = #lease{id=Id, epoch=OldEpoch}, NewOwner) ->
      Timeout = util:time_plus_s(os:timestamp(), delta()),
      New = Old#lease{epoch = OldEpoch + 1,
                      owner = NewOwner,
                      version = 0,
                      timeout = Timeout},
      write(Id, New, fun l_on_cseq:is_valid_handover/3).
  
  
  
  -spec read(lease_id()) -> api_tx:read_result().
  read(Key) ->
      %% decide which lease db is responsible, ie. if the key is from
      %% the first quarter of the ring, use lease_db1, if from 2nd
      %% quarter -> use lease_db2, ...
      DB = erlang:list_to_existing_atom(
             lists:flatten(
               io_lib:format("lease_db~p", [?RT:get_key_segment(Key, 4)]))),
  
      %% perform qread
      rbrcseq:qread(DB, self(), Key),
      receive
          ?SCALARIS_RECV({qread_done, _ReqId, _Round, Value},
                         case Value of
  
negative.code: % @copyright 2012 Zuse Institute Berlin,
  
  %   Licensed under the Apache License, Version 2.0 (the "License");
  %   you may not use this file except in compliance with the License.
  %   You may obtain a copy of the License at
  %
  %       http://www.apache.org/licenses/LICENSE-2.0
  %
  %   Unless required by applicable law or agreed to in writing, software
  %   distributed under the License is distributed on an "AS IS" BASIS,
  %   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  %   See the License for the specific language governing permissions and
  %   limitations under the License.
  
  %% @author Florian Schintke <schintke@zib.de>
  %% @doc lease store based on rbrcseq.
  