def cmd_destroy_shelf(self, cmdict):
""" For a shelf, zombify books (mark for zeroing) and remove xattrs
In (dict)---
path
node
Out (dict) ---
shelf data
"""
self.errno = errno.EBUSY
shelf = self.cmd_get_shelf(cmdict)
assert not self.db.open_count(
shelf), '%s has active opens' % shelf.name
bos = self._list_shelf_books(shelf)
xattrs = self.db.list_xattrs(shelf)
for thisbos in bos:
self.db.delete_bos(thisbos)
_ = self._set_book_alloc(thisbos, TMBook.ALLOC_ZOMBIE)
for xattr in xattrs:
self.db.remove_xattr(shelf, xattr)
rsp = self.db.delete_shelf(shelf, commit=True)
return rsp
评论列表
文章目录