core (memory, sqlite): added fileUpdate method to update "extra" and "access" avoiding race condition
This commit is contained in:
parent
50a7be4fe4
commit
97f19b2e52
1 changed files with 54 additions and 0 deletions
|
|
@ -1302,6 +1302,18 @@ class Memory(object):
|
|||
owner=owner,
|
||||
access=access, extra=extra)
|
||||
|
||||
def fileUpdate(self, file_id, column, update_cb):
|
||||
"""update a file column taking care of race condition
|
||||
|
||||
access is NOT checked in this method, it must be checked beforehand
|
||||
@param file_id(unicode): id of the file to update
|
||||
@param column(unicode): one of "access" or "extra"
|
||||
@param update_cb(callable): method to update the value of the colum
|
||||
the method will take older value as argument, and must update it in place
|
||||
Note that the callable must be thread-safe
|
||||
"""
|
||||
return self.storage.fileUpdate(file_id, column, update_cb)
|
||||
|
||||
## Misc ##
|
||||
|
||||
def isEntityAvailable(self, entity_jid, profile_key):
|
||||
|
|
|
|||
Loading…
Reference in a new issue