Merge "Eliminate can_delete_db"
This commit is contained in:
commit
b5d0fadf99
@ -1448,29 +1448,6 @@ class AccountBroker(DatabaseBroker):
|
|||||||
protocol=PICKLE_PROTOCOL).encode('base64'))
|
protocol=PICKLE_PROTOCOL).encode('base64'))
|
||||||
fp.flush()
|
fp.flush()
|
||||||
|
|
||||||
def can_delete_db(self, cutoff):
|
|
||||||
"""
|
|
||||||
Check if the accont DB can be deleted.
|
|
||||||
|
|
||||||
:returns: True if the account can be deleted, False otherwise
|
|
||||||
"""
|
|
||||||
self._commit_puts()
|
|
||||||
with self.get() as conn:
|
|
||||||
row = conn.execute('''
|
|
||||||
SELECT status, put_timestamp, delete_timestamp, container_count
|
|
||||||
FROM account_stat''').fetchone()
|
|
||||||
# The account is considered deleted if its status is marked
|
|
||||||
# as 'DELETED" and the delete_timestamp is older than the supplied
|
|
||||||
# cutoff date; or if the delete_timestamp value is greater than
|
|
||||||
# the put_timestamp, and there are no containers for the account
|
|
||||||
status_del = (row['status'] == 'DELETED')
|
|
||||||
deltime = float(row['delete_timestamp'])
|
|
||||||
past_cutoff = (deltime < cutoff)
|
|
||||||
time_later = (row['delete_timestamp'] > row['put_timestamp'])
|
|
||||||
no_containers = (row['container_count'] in (None, '', 0, '0'))
|
|
||||||
return (
|
|
||||||
(status_del and past_cutoff) or (time_later and no_containers))
|
|
||||||
|
|
||||||
def is_deleted(self):
|
def is_deleted(self):
|
||||||
"""
|
"""
|
||||||
Check if the account DB is considered to be deleted.
|
Check if the account DB is considered to be deleted.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user