core (memory, memory/sqlite): implemented fileDelete
This commit is contained in:
parent
a3c67e1072
commit
80da9a6591
1 changed files with 71 additions and 1 deletions
|
|
@ -931,7 +931,7 @@ class SqliteStorage(object):
|
|||
log.error(_(u"Can't update file table"))
|
||||
|
||||
def fileUpdate(self, file_id, column, update_cb):
|
||||
"""update a column value using a method to avoid race conditions
|
||||
"""Update a column value using a method to avoid race conditions
|
||||
|
||||
the older value will be retrieved from database, then update_cb will be applied
|
||||
to update it, and file will be updated checking that older value has not been changed meanwhile
|
||||
|
|
@ -948,6 +948,15 @@ class SqliteStorage(object):
|
|||
raise exceptions.InternalError('bad column name')
|
||||
return self.dbpool.runInteraction(self._fileUpdate, file_id, column, update_cb)
|
||||
|
||||
def fileDelete(self, file_id):
|
||||
"""Delete file metadata from the database
|
||||
|
||||
@param file_id(unicode): id of the file to delete
|
||||
NOTE: file itself must still be removed, this method only handle metadata in
|
||||
database
|
||||
"""
|
||||
return self.dbpool.runQuery("DELETE FROM files WHERE id = ?", (file_id,))
|
||||
|
||||
##Helper methods##
|
||||
|
||||
def __getFirstResult(self, result):
|
||||
|
|
|
|||
Loading…
Reference in a new issue