core (memory, sqlite): new fileGetUsedSpace method
This commit is contained in:
parent
672d35d44f
commit
06054ceeaf
1 changed files with 29 additions and 2 deletions
|
|
@ -986,6 +986,15 @@ class SqliteStorage(object):
|
|||
d.addErrback(lambda failure: log.error(_("Can't save file metadata for [{profile}]: {reason}".format(profile=client.profile, reason=failure))))
|
||||
return d
|
||||
|
||||
async def fileGetUsedSpace(self, client, owner):
|
||||
"""Get space used by owner of file"""
|
||||
query = "SELECT SUM(size) FROM files WHERE owner=? AND type='file' AND profile_id=?"
|
||||
ret = await self.dbpool.runQuery(
|
||||
query,
|
||||
(owner.userhost(), self.profiles[client.profile])
|
||||
)
|
||||
return ret[0][0]
|
||||
|
||||
def _fileUpdate(self, cursor, file_id, column, update_cb):
|
||||
query = 'SELECT {column} FROM files where id=?'.format(column=column)
|
||||
for i in range(5):
|
||||
|
|
|
|||
Loading…
Reference in a new issue