Skip to content

Commit

Permalink
Eliminate can_delete_db
Browse files Browse the repository at this point in the history
The method can_delete_db() appears to be not only unused, but has
always been so. I verified this going back to Austin release. It is
very strange that we never noticed it until now, but here it is.

Change-Id: I4445c4b2c4721f880c9dbb1eac055c0601ae6372
  • Loading branch information
zaitcev committed Jul 30, 2013
1 parent 87ab2f6 commit f9e73a0
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions swift/common/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,29 +1447,6 @@ def put_container(self, name, put_timestamp, delete_timestamp,
protocol=PICKLE_PROTOCOL).encode('base64'))
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):
"""
Check if the account DB is considered to be deleted.
Expand Down

0 comments on commit f9e73a0

Please sign in to comment.