[tahoe-lafs-trac-stream] [Tahoe-LAFS] #3773: Merge adding lease with renewing lease (for immutables)

Tahoe-LAFS trac at tahoe-lafs.org
Wed Aug 18 15:20:51 UTC 2021


#3773: Merge adding lease with renewing lease (for immutables)
--------------------------+-----------------------------------
     Reporter:  itamarst  |      Owner:  itamarst
         Type:  task      |     Status:  new
     Priority:  normal    |  Milestone:  HTTP Storage Protocol
    Component:  unknown   |    Version:  n/a
   Resolution:            |   Keywords:
Launchpad Bug:            |
--------------------------+-----------------------------------

Comment (by exarkun):

 Regarding item 4 from the first list:

 Here is the implementation of `add_lease` from
 `allmydata/storage/server.py`:
 {{{
     def remote_add_lease(self, storage_index, renew_secret, cancel_secret,
                          owner_num=1):
         start = time.time()
         self.count("add-lease")
         new_expire_time = time.time() + 31*24*60*60
         lease_info = LeaseInfo(owner_num,
                                renew_secret, cancel_secret,
                                new_expire_time, self.my_nodeid)
         for sf in self._iter_share_files(storage_index):
             sf.add_or_renew_lease(lease_info)
         self.add_latency("add-lease", time.time() - start)
         return None
 }}}

 And here is the implementation of `MutableShareFile.add_or_renew_lease`
 from `allmydata/storage/mutable.py:

 {{{
     def add_or_renew_lease(self, lease_info):
         precondition(lease_info.owner_num != 0) # 0 means "no lease here"
         try:
             self.renew_lease(lease_info.renew_secret,
                              lease_info.expiration_time)
         except IndexError:
             self.add_lease(lease_info)
 }}}

 And here is the implementation of `ShareFile.add_or_renew_lease` from
 `allmydata/storage/immutable.py:

 {{{
     def add_or_renew_lease(self, lease_info):
         try:
             self.renew_lease(lease_info.renew_secret,
                              lease_info.expiration_time)
         except IndexError:
             self.add_lease(lease_info)
 }}}

 (woops nice divergence in safety properties there)

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3773#comment:2>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list