Add user id index to usage size keys

This commit is contained in:
2013-04-21 17:48:21 +02:00
parent 45d44bbf26
commit 1a9be076fa
2 changed files with 6 additions and 2 deletions

View File

@@ -156,12 +156,13 @@ module RemoteStorage
def log_object_size(user, directory, new_size=0, old_size=0)
category = extract_category(directory)
info = info_bucket.get_or_new("usage:size:#{user}:#{category}")
info.content_type = "text/plain"
size = -old_size + new_size
size += info.data.to_i
info.data = size.to_s
info.indexes.merge!({:user_id_bin => [user]})
info.store
end