Recompute the quota usage of a project. This is useful on rare occasions where multiple simultaneous uploads cause the usage calculations to be out of sync.

refreshUsage(project, staging, url)

Arguments

project

String containing the project name.

staging

String containing the path to the staging directory.

url

String containing the URL of the gobbler REST API.

Value

Numeric scalar specifying the total quota usage of this project, in bytes.

See also

fetchUsage, to get the usage without recomputing it.

Author

Aaron Lun

Examples

info <- startGobbler()
removeProject("test", info$staging, url=info$url) # start with a clean slate.
createProject("test", info$staging, url=info$url)

# Mocking up an upload. 
src <- allocateUploadDirectory(info$staging)
write(file=file.path(src, "foo"), "BAR")
write(file=file.path(src, "whee"), "stuff")
uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)

# Messing with the project usage:
write(file=file.path(info$registry, "test", "..usage"), '{ "total": 0 }')
fetchUsage("test", registry=info$registry)
#> [1] 0

# Fixing the project usage.
refreshUsage("test", staging=info$staging, url=info$url)
fetchUsage("test", registry=info$registry)
#> [1] 10