1.1 --- a/imip_store.py Sat Sep 12 19:58:59 2015 +0200
1.2 +++ b/imip_store.py Sat Sep 12 20:16:38 2015 +0200
1.3 @@ -554,16 +554,6 @@
1.4 return map(lambda t: FreeBusyPeriod(*t),
1.5 (get_table or self._get_table_atomic)(user, filename, [(4, None)]))
1.6
1.7 - def get_freebusy_for_update(self, user, name=None):
1.8 -
1.9 - """
1.10 - Get free/busy details for the given 'user', locking the table. Dependent
1.11 - code must release this lock regardless of it completing successfully.
1.12 - """
1.13 -
1.14 - self.acquire_lock(user)
1.15 - return self.get_freebusy(user, name, self._get_table)
1.16 -
1.17 def get_freebusy_for_other(self, user, other, get_table=None):
1.18
1.19 "For the given 'user', get free/busy details for the 'other' user."
1.20 @@ -575,17 +565,6 @@
1.21 return map(lambda t: FreeBusyPeriod(*t),
1.22 (get_table or self._get_table_atomic)(user, filename, [(4, None)]))
1.23
1.24 - def get_freebusy_for_other_for_update(self, user, other):
1.25 -
1.26 - """
1.27 - For the given 'user', get free/busy details for the 'other' user,
1.28 - locking the table. Dependent code must release this lock regardless of
1.29 - it completing successfully.
1.30 - """
1.31 -
1.32 - self.acquire_lock(user)
1.33 - return self.get_freebusy_for_other(user, other, self._get_table)
1.34 -
1.35 def set_freebusy(self, user, freebusy, name=None, set_table=None):
1.36
1.37 "For the given 'user', set 'freebusy' details."
1.38 @@ -598,12 +577,6 @@
1.39 map(lambda fb: fb.as_tuple(strings_only=True), freebusy))
1.40 return True
1.41
1.42 - def set_freebusy_in_update(self, user, freebusy, name=None):
1.43 -
1.44 - "For the given 'user', set 'freebusy' details during a compound update."
1.45 -
1.46 - return self.set_freebusy(user, freebusy, name, self._set_table)
1.47 -
1.48 def set_freebusy_for_other(self, user, freebusy, other, set_table=None):
1.49
1.50 "For the given 'user', set 'freebusy' details for the 'other' user."
1.51 @@ -616,19 +589,6 @@
1.52 map(lambda fb: fb.as_tuple(strings_only=True), freebusy))
1.53 return True
1.54
1.55 - def set_freebusy_for_other_in_update(self, user, freebusy, other):
1.56 -
1.57 - """
1.58 - For the given 'user', set 'freebusy' details for the 'other' user during
1.59 - a compound update.
1.60 - """
1.61 -
1.62 - return self.set_freebusy_for_other(user, freebusy, other, self._set_table)
1.63 -
1.64 - # Release methods.
1.65 -
1.66 - release_freebusy = release_lock
1.67 -
1.68 # Tentative free/busy periods related to countering.
1.69
1.70 def get_freebusy_offers(self, user):
1.71 @@ -641,8 +601,9 @@
1.72
1.73 # Expire old offers and save the collection if modified.
1.74
1.75 - l = self.get_freebusy_for_update(user, "freebusy-offers")
1.76 + self.acquire_lock(user)
1.77 try:
1.78 + l = self.get_freebusy(user, "freebusy-offers")
1.79 for fb in l:
1.80 if fb.expires and get_datetime(fb.expires) <= now:
1.81 expired.append(fb)
1.82 @@ -650,35 +611,18 @@
1.83 offers.append(fb)
1.84
1.85 if expired:
1.86 - self.set_freebusy_offers_in_update(user, offers)
1.87 -
1.88 + self.set_freebusy_offers(user, offers)
1.89 finally:
1.90 - self.release_freebusy(user)
1.91 + self.release_lock(user)
1.92
1.93 return offers
1.94
1.95 - def get_freebusy_offers_for_update(self, user):
1.96 -
1.97 - """
1.98 - Get free/busy offers for the given 'user', locking the table. Dependent
1.99 - code must release this lock regardless of it completing successfully.
1.100 - """
1.101 -
1.102 - self.acquire_lock(user)
1.103 - return self.get_freebusy_offers(user)
1.104 -
1.105 def set_freebusy_offers(self, user, freebusy):
1.106
1.107 "For the given 'user', set 'freebusy' offers."
1.108
1.109 return self.set_freebusy(user, freebusy, "freebusy-offers")
1.110
1.111 - def set_freebusy_offers_in_update(self, user, freebusy):
1.112 -
1.113 - "For the given 'user', set 'freebusy' offers during a compound update."
1.114 -
1.115 - return self.set_freebusy_in_update(user, freebusy, "freebusy-offers")
1.116 -
1.117 # Object status details access.
1.118
1.119 def _get_requests(self, user, queue):